-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: clarify how read_csv nrows interacts with header and skiprows argument #59078
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
1 task done
Labels
Comments
Thanks for the suggestion. PRs are welcomed! |
Ok. I'll do that in the next week. Note to myself: I need to test how rows with quoted newlines within string cells are counted. |
mdavis-xyz
added a commit
to mdavis-xyz/pandas
that referenced
this issue
Jun 24, 2024
5 tasks
mdavis-xyz
added a commit
to mdavis-xyz/pandas
that referenced
this issue
Jun 24, 2024
mdavis-xyz
added a commit
to mdavis-xyz/pandas
that referenced
this issue
Jun 24, 2024
take |
5 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Pandas version checks
main
hereLocation of the documentation
https://pandas.pydata.org/pandas-docs/stable/reference/api/pandas.read_csv.html
Documentation problem
The documentation for
read_csv
'snrows
argument says:I want to read a file using
header=1
, and then limit the number of rows. The documentation says this counts the number of rows of the file. To me that sounds like it includes the skipped row and the column header row, since pandas still reads those rows from the file. But I've done some testing. Thenrows
argument counts the number of data rows. It excludes the skipped rows, and excludes the column header row.skiprows
is the same (skipped rows aren't counted towardsnrows
). When I have a row which is a comment, that also doesn't count towardsnrows
.For
nrows=2
, it seems to always return 2 rows.Suggested fix for documentation
The text was updated successfully, but these errors were encountered: