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
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions pandas/io/parsers/readers.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,6 +268,18 @@ class _read_shared(TypedDict, Generic[HashableT], total=False):
Number of lines at bottom of file to skip (Unsupported with ``engine='c'``).
nrows : int, optional
Number of rows of file to read. Useful for reading pieces of large files.
Refers to the number of data rows in the returned DataFrame, excluding:

* The header row containing column names.
* Rows before the header row, if ``header=1`` or larger.

Example usage:

* To read the first 999,999 (non-header) rows:
``read_csv(..., nrows=999999)``

* To read rows 1,000,000 through 1,999,999:
``read_csv(..., skiprows=1000000, nrows=999999)``
na_values : Hashable, Iterable of Hashable or dict of {{Hashable : Iterable}}, optional
Additional strings to recognize as ``NA``/``NaN``. If ``dict`` passed, specific
per-column ``NA`` values. By default the following values are interpreted as
Expand Down
Loading