Как исправить ValueError: слишком много значений для распаковки (ожидается 3)? - PullRequest
2 голосов
/ 15 апреля 2020

У меня есть этот кусок кода, и он дает мне желаемый результат, но также показывает ошибку, что означает эта ошибка и как ее исправить?

s_and = df_android['Category']
total_and = s_and.value_counts()
percentage_and = s_and.value_counts(normalize=True).mul(100).round(2)

percentage_tab_and = pd.DataFrame({'Total':total_and, 'Percentage':percentage_and}).reset_index()
percentage_tab_and = percentage_tab_and.rename(columns={"index": "Category"})
percentage_tab_and.head(5)

Результат:

|  Category   | Total       | Percentage |
| ----------- | ----------- |------------|
| Dict        | 3           |    36      |
| Book        | 2           |    24      |

Ошибка:

ValueError                                Traceback (most recent call last)
~\anaconda3\lib\site-packages\pycodestyle_magic.py in auto_run_pycodestyle(self, result)
     44 
     45     def auto_run_pycodestyle(self, result):
---> 46         pycodestyle(1, result.info.raw_cell, auto=True)
     47         if result.error_before_exec:
     48             print('Error before execution: %s' % result.error_before_exec)

<C:\Users\Sinch\anaconda3\lib\site-packages\decorator.py:decorator-gen-131> in pycodestyle(line, cell, auto)

~\anaconda3\lib\site-packages\IPython\core\magic.py in <lambda>(f, *a, **k)
    218     # but it's overkill for just that one bit of state.
    219     def magic_deco(arg):
--> 220         call = lambda f, *a, **k: f(*a, **k)
    221 
    222         # Find get_ipython() in the caller's namespace

~\anaconda3\lib\site-packages\pycodestyle_magic.py in pycodestyle(line, cell, auto)
    173         #logger.info(line)
    174         # on windows drive path also contains :
--> 175         line, col, error = line.split(':')[-4:]
    176         # do not subtract 1 for line for %%pycodestyle, inc pre py3.6 string
    177         if auto:

ValueError: too many values to unpack (expected 3)
...