Skip to content

BUG: Fixed maximum columns limit when using usecols for csv. #8985 #9029

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

Closed
wants to merge 1 commit into from

Conversation

dxe4
Copy link
Contributor

@dxe4 dxe4 commented Dec 6, 2014

fixes #8985

if self.usecols and len(l) > col_len:
continue
else:
incorrect_row = True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you don't need to use this variable incorrect_row, just raise right here (and and reverse the if condition)

e.g.

if not (self.usecols and len(l) > col_len):
    raise ValueError(.....)

@jreback jreback added Bug IO CSV read_csv, to_csv Error Reporting Incorrect or improved errors from pandas labels Dec 7, 2014
@dxe4
Copy link
Contributor Author

dxe4 commented Dec 7, 2014

fixing the c engine, will also add some more tests because the case usecols=['spam', 'eggs'] should fail.

@dxe4 dxe4 closed this Dec 7, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Error Reporting Incorrect or improved errors from pandas IO CSV read_csv, to_csv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

csv_reader with limited number of columns should should completely disregard the unused fields
2 participants