Skip to content

Equivalent to df[:n] for non-negative values too #57305

Closed
@snoyes

Description

@snoyes

The documentation for pandas.DataFrame.head mentions that negative values of n are equivalent to df[:n]. This is true for all values of n.

pandas/pandas/core/generic.py

Lines 5617 to 5618 in 2110b74

For negative values of `n`, this function returns all rows except
the last `|n|` rows, equivalent to ``df[:n]``.

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