Skip to content

DOC: read_csv with skiprows parameter skips from current position, not from start of file #52270

@Black-Maille

Description

@Black-Maille

Pandas version checks

  • I have checked that the issue still exists on the latest versions of the docs on main here

Location of the documentation

https://pandas.pydata.org/docs/dev/reference/api/pandas.read_csv.html

Documentation problem

According to documentation, skiprows parameter skips row from the beginning of the file, which is not the actual behaviour.
Actually, it skips from the current position within the file, so e.g. after a readline() command, skiprows=1 will lead to line 3 being the first to be read.
I checked this with Pandas 1.3 (unfortunately, I am stuck on this version for now), but the documentation has not changed in this regard to the current version.
I am assuming the header parameter has similar issues.

Suggested fix for documentation

Current text:
Line numbers to skip (0-indexed) or number of lines to skip (int) at the start of the file.

Proposed change:
Line numbers to skip (0-indexed) or number of lines to skip (int) from the current position within the file (at the start of the file if freshly opened).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions