diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 9f9dffaaa399f..1101938ace109 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -5162,6 +5162,9 @@ def head(self: NDFrameT, n: int = 5) -> NDFrameT: For negative values of `n`, this function returns all rows except the last `n` rows, equivalent to ``df[:-n]``. + `n` can be larger than the object size (this conforms with python/numpy + slice semantics). + Parameters ---------- n : int, default 5 @@ -5235,6 +5238,9 @@ def tail(self: NDFrameT, n: int = 5) -> NDFrameT: For negative values of `n`, this function returns all rows except the first `n` rows, equivalent to ``df[n:]``. + `n` can be larger than the object size (this conforms with python/numpy + slice semantics). + Parameters ---------- n : int, default 5