Skip to content

DOC: Clarify nrows behavior in read_csv #59467

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 2 commits into from
Aug 12, 2024
Merged

Conversation

johnyu013
Copy link
Contributor

Here’s the updated summary with a note section included:

Summary:

This pull request updates the nrows parameter documentation for read_csv to address ambiguity in the previous text. The original documentation was vague and did not clearly specify that nrows counts only the data rows returned, excluding the header, and skipped rows. The revised documentation provides a clearer definition of nrows and includes practical examples to better illustrate its usage, improving the overall clarity of the documentation.

Note:

Thanks to the suggestions from a previous PR made by the issuer and insights from Stack Overflow (https://stackoverflow.com/questions/23853553/python-pandas-how-to-read-only-first-n-rows-of-csv-files-in), the updated documentation hopefully clarifies that nrows excludes rows skipped with skiprows, and the header row. Please let me know if any examples should be added, revised, or removed to further enhance clarity. I understand that the example with skiprows might seem obvious, but it was included to address potential confusion.

@mroeschke mroeschke added the Docs label Aug 12, 2024
@mroeschke mroeschke added this to the 3.0 milestone Aug 12, 2024
@mroeschke mroeschke merged commit 9c776ae into pandas-dev:main Aug 12, 2024
50 of 51 checks passed
@mroeschke
Copy link
Member

Thanks @johnyu013

shreyas-dev pushed a commit to shreyas-dev/pandas that referenced this pull request Aug 13, 2024
* DOC: Clarify nrows behavior in read_csv

* Remove whitespace from a blank line
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DOC: clarify how read_csv nrows interacts with header and skiprows argument
2 participants