Skip to content

Error: Too many values to unpack #34

Description

@linhhlp

Hi everyone,

I encountered this issue and didn't know why it was an error

Importing Pandas, Create DF

import pandas as pd
df = pd.DataFrame({'col1': [1, 2], 'col2': [3, 4]})

It works well until I want to validate/filter based on some conditions, and pycodestyle_magic stops

df2 = df.loc[
    (df.col1 == True), ["col1", "col2"]
]

This code should work without problems. The formatting was created by black on .py file and copy to Jupyter notebook.

Error content:

ValueError                                Traceback (most recent call last)
File [c:\Users\kim_l\anaconda3\envs\machinelearning\lib\site-packages\pycodestyle_magic.py:46](file:///C:/Users/kim_l/anaconda3/envs/machinelearning/lib/site-packages/pycodestyle_magic.py:46), in VarWatcher.auto_run_pycodestyle(self, result)
     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)

File [c:\Users\kim_l\anaconda3\envs\machinelearning\lib\site-packages\pycodestyle_magic.py:175](file:///C:/Users/kim_l/anaconda3/envs/machinelearning/lib/site-packages/pycodestyle_magic.py:175), in pycodestyle(line, cell, auto)
    170 stdout = sys.stdout.getvalue().splitlines()   
    172 for line in stdout:
    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)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions