Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Too many values to unpack #34

Open
linhhlp opened this issue Mar 31, 2023 · 0 comments
Open

Error: Too many values to unpack #34

linhhlp opened this issue Mar 31, 2023 · 0 comments

Comments

@linhhlp
Copy link

linhhlp commented Mar 31, 2023

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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant