Skip to content

Commit 9c776ae

Browse files
authored
DOC: Clarify nrows behavior in read_csv (#59467)
* DOC: Clarify nrows behavior in read_csv * Remove whitespace from a blank line
1 parent db630fc commit 9c776ae

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

pandas/io/parsers/readers.py

+12
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,18 @@ class _read_shared(TypedDict, Generic[HashableT], total=False):
268268
Number of lines at bottom of file to skip (Unsupported with ``engine='c'``).
269269
nrows : int, optional
270270
Number of rows of file to read. Useful for reading pieces of large files.
271+
Refers to the number of data rows in the returned DataFrame, excluding:
272+
273+
* The header row containing column names.
274+
* Rows before the header row, if ``header=1`` or larger.
275+
276+
Example usage:
277+
278+
* To read the first 999,999 (non-header) rows:
279+
``read_csv(..., nrows=999999)``
280+
281+
* To read rows 1,000,000 through 1,999,999:
282+
``read_csv(..., skiprows=1000000, nrows=999999)``
271283
na_values : Hashable, Iterable of Hashable or dict of {{Hashable : Iterable}}, optional
272284
Additional strings to recognize as ``NA``/``NaN``. If ``dict`` passed, specific
273285
per-column ``NA`` values. By default the following values are interpreted as

0 commit comments

Comments
 (0)