-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Fixing 'names' doc for 'read_csv' #30109
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
@@ -120,7 +120,7 @@ | |||
data rather than the first line of the file. | |||
names : array-like, optional | |||
List of column names to use. If file contains no header row, then you | |||
should explicitly pass ``header=None``. Duplicates in this list are not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
‘If the file contains a header row, then you should explicitly pass ‘’header=0’’ to override the column names.’ - I think that would make more sense?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you. I've rechecked who the system is working (I've added the comment with the details) and I have updated the text as you have suggested.
3bf26f1
to
6c5b1e0
Compare
I made one more python notebook to check how the code works when there is no header in csv: The current doc text is:
As you can see from pandas read_csv no-header.ipynb
So I think there should be no such text in the doc. But when there is a header in csv file you must specify |
pandas/io/parsers.py
Outdated
List of column names to use. If file contains no header row, then you | ||
should explicitly pass ``header=None``. Duplicates in this list are not | ||
allowed. | ||
List of column names to use. If the file contain a header row, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry minor typo from me should be ‘file contains’
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops. Fixed, thank you.
6c5b1e0
to
ba0cff3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
thanks @bessarabov |
black pandas
git diff upstream/master -u -- "*.py" | flake8 --diff
I think there is a bug in the docs. This Jupyter notebook shows that the code does not work as expected from the docs https://gist.github.com/bessarabov/5e42bbb359fb86aaa87aed6c12a95bc9
So I've fixed the doc to match behaviour.