-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
csv_reader with limited number of columns should should completely disregard the unused fields #8985
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
Comments
this is like #6710. Usecols will only select from the valid columns. It is inferring that you have 3, so it is a bit contradictory here. Soln is to use names (or
not sure if this is a bug or not; i'll mark it same as the other one. |
I don't agree that they are the same bug. Bug #6710 is about the ability to infer whether the next lines will have more fields or not. In this case, all rows have all fields of interest ( [0:6] ). The remaining of the line will not be used anyway and should not be considered at all. |
@cordeiro I said they are alike, that's why its a separate issue :) |
Oups. :) |
np. if you do have interested in looking at this would be appreciated. |
sounds easy ill try to make a pr today for this |
xref #6710
I have a CSV whose lines may have 11 or 18 fields. I only need to read the first 6 fields, so I use "usecols=range(6)". Even with the limited number of columns, I get the exception:
ValueError: Expected 11 fields in line 776483, saw 18
The csv_reader should completely disregard the unused fields.
Small test case:
It also affects the C engine.
Discussed at the users mailing list at https://groups.google.com/d/topic/pydata/vjhFpHtgnvw/discussion
The text was updated successfully, but these errors were encountered: