Skip to content

BUG: Fix read_csv IndexError crash for c engine with header=None and 2 (or more) extra columns #32839

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

Conversation

roberthdevries
Copy link
Contributor

@roberthdevries roberthdevries commented Mar 19, 2020

@roberthdevries roberthdevries changed the title Fix read_csv IndexError crash for c engine with header=None and 2 (or more) extra columns BUG: Fix read_csv IndexError crash for c engine with header=None and 2 (or more) extra columns Mar 19, 2020
@roberthdevries roberthdevries force-pushed the fix-26128-read_csv-crash-c-engine-header-None-2-extra-columns branch from 241fcfc to 440470e Compare March 20, 2020 18:56
@jreback jreback added the IO CSV read_csv, to_csv label Mar 21, 2020
@jreback jreback added this to the 1.1 milestone Mar 21, 2020
@jreback jreback added the Bug label Mar 21, 2020
@@ -1316,8 +1316,8 @@ cdef class TextReader:
else:
if self.header is not None:
j = i - self.leading_cols
# hack for #2442
if j == len(self.header[0]):
# hack for #2442 and #26218
Copy link
Contributor

Choose a reason for hiding this comment

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

can you remove the 'hack' word; rather put an explan what is happening here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed

@jreback jreback requested a review from gfyoung March 21, 2020 20:45
@roberthdevries roberthdevries force-pushed the fix-26128-read_csv-crash-c-engine-header-None-2-extra-columns branch from 606fd84 to 2ba6a4d Compare March 22, 2020 19:37
@roberthdevries roberthdevries requested a review from jreback March 22, 2020 19:38
@jreback jreback merged commit 7609df1 into pandas-dev:master Mar 22, 2020
@jreback
Copy link
Contributor

jreback commented Mar 22, 2020

thanks @roberthdevries

SeeminSyed pushed a commit to CSCD01-team01/pandas that referenced this pull request Mar 22, 2020
@roberthdevries roberthdevries deleted the fix-26128-read_csv-crash-c-engine-header-None-2-extra-columns branch March 25, 2020 20:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug IO CSV read_csv, to_csv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read_csv() crashes if engine='c', header=None, and 2+ extra columns
3 participants