Skip to content

API: raise on header=bool in parsers #11182

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

Merged
merged 1 commit into from
Sep 24, 2015

Conversation

chris-b1
Copy link
Contributor

closes #6113

Passing header=True|False to read_csv (and brethren), read_excel, and read_html will now raise a TypeError, rather than being coerced to an int.

I had thought about converting False to None but thought that could break someone's code in a very subtle way if they were somehow depending on the old behavior. But happy to change that if it seems better.

If you want to push this in for 0.17 I can add a doc-note or this could easily wait.

#GH 6114
with tm.assertRaises(TypeError):
pd.read_excel(os.path.join(self.dirpath, 'test1' + self.ext),
header=False)
Copy link
Contributor

Choose a reason for hiding this comment

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

test for True as well (in read_csv too)

@jreback jreback added API Design IO CSV read_csv, to_csv labels Sep 24, 2015
@jreback
Copy link
Contributor

jreback commented Sep 24, 2015

@chris-b1 if you add a release note (put in the API section) can add for 0.17.0

@jreback jreback added this to the 0.17.0 milestone Sep 24, 2015
@chris-b1
Copy link
Contributor Author

@jreback added a doc note and testing for the True case.


In earlier versions of pandas, if a bool was passed the ``header`` argument of
``read_csv``, ``read_excel``, or ``read_html`` it was implicitly converted to
an integer, resulting in ``header=0`` for ``False`` and ``header=1`` for ``True``
Copy link
Contributor

Choose a reason for hiding this comment

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

add the issue number here

@jreback
Copy link
Contributor

jreback commented Sep 24, 2015

tiny doc-change. ping when you push

@chris-b1
Copy link
Contributor Author

@jreback thanks, made that change

jreback added a commit that referenced this pull request Sep 24, 2015
API: raise on header=bool in parsers
@jreback jreback merged commit 38ee8c7 into pandas-dev:master Sep 24, 2015
@jreback
Copy link
Contributor

jreback commented Sep 24, 2015

thank you sir!

@jorisvandenbossche
Copy link
Member

Nice!

@chris-b1 chris-b1 deleted the header-bool-readers branch September 26, 2015 15:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design IO CSV read_csv, to_csv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

read_table, header flag. false interpreted as 0.
3 participants