Skip to content

Commit 2c8dfc0

Browse files
jackgoldsmith4yehoshuadimarsky
authored andcommitted
Add absolute value to head() and tail() docstrings for negative values of n (pandas-dev#47195)
* add absolute value to head and tail docstrings * remove minus sign because n is already negative
1 parent 338fd56 commit 2c8dfc0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/generic.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -5182,7 +5182,7 @@ def head(self: NDFrameT, n: int = 5) -> NDFrameT:
51825182
has the right type of data in it.
51835183
51845184
For negative values of `n`, this function returns all rows except
5185-
the last `n` rows, equivalent to ``df[:-n]``.
5185+
the last `|n|` rows, equivalent to ``df[:n]``.
51865186
51875187
If n is larger than the number of rows, this function returns all rows.
51885188
@@ -5257,7 +5257,7 @@ def tail(self: NDFrameT, n: int = 5) -> NDFrameT:
52575257
after sorting or appending rows.
52585258
52595259
For negative values of `n`, this function returns all rows except
5260-
the first `n` rows, equivalent to ``df[n:]``.
5260+
the first `|n|` rows, equivalent to ``df[|n|:]``.
52615261
52625262
If n is larger than the number of rows, this function returns all rows.
52635263

0 commit comments

Comments
 (0)