From 4b97f32793b3ae6c53200d0ac2a7fbcb600c2a6d Mon Sep 17 00:00:00 2001 From: jackgoldsmith4 Date: Wed, 1 Jun 2022 22:14:18 -0400 Subject: [PATCH 1/2] add absolute value to head and tail docstrings --- pandas/core/generic.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index d5b55a89f28df..5fe900809a1e0 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -5182,7 +5182,7 @@ def head(self: NDFrameT, n: int = 5) -> NDFrameT: has the right type of data in it. For negative values of `n`, this function returns all rows except - the last `n` rows, equivalent to ``df[:-n]``. + the last `|n|` rows, equivalent to ``df[:-n]``. If n is larger than the number of rows, this function returns all rows. @@ -5257,7 +5257,7 @@ def tail(self: NDFrameT, n: int = 5) -> NDFrameT: after sorting or appending rows. For negative values of `n`, this function returns all rows except - the first `n` rows, equivalent to ``df[n:]``. + the first `|n|` rows, equivalent to ``df[|n|:]``. If n is larger than the number of rows, this function returns all rows. From 07f3bb08be8f8751501281765df72dd8a338f503 Mon Sep 17 00:00:00 2001 From: jackgoldsmith4 Date: Wed, 1 Jun 2022 22:15:20 -0400 Subject: [PATCH 2/2] remove minus sign because n is already negative --- pandas/core/generic.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 5fe900809a1e0..ebb853c00872b 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -5182,7 +5182,7 @@ def head(self: NDFrameT, n: int = 5) -> NDFrameT: has the right type of data in it. For negative values of `n`, this function returns all rows except - the last `|n|` rows, equivalent to ``df[:-n]``. + the last `|n|` rows, equivalent to ``df[:n]``. If n is larger than the number of rows, this function returns all rows.