Skip to content

Commit e14431f

Browse files
yosukeBaya4jorisvandenbossche
authored andcommitted
DOC: Expand docstrings for head / tail methods (#16941)
1 parent 58d8729 commit e14431f

File tree

1 file changed

+24
-2
lines changed

1 file changed

+24
-2
lines changed

pandas/core/generic.py

+24-2
Original file line numberDiff line numberDiff line change
@@ -2978,14 +2978,36 @@ def filter(self, items=None, like=None, regex=None, axis=None):
29782978

29792979
def head(self, n=5):
29802980
"""
2981-
Returns first n rows
2981+
Return the first n rows.
2982+
2983+
Parameters
2984+
----------
2985+
n : int, default 5
2986+
Number of rows to select.
2987+
2988+
Returns
2989+
-------
2990+
obj_head : type of caller
2991+
The first n rows of the caller object.
29822992
"""
2993+
29832994
return self.iloc[:n]
29842995

29852996
def tail(self, n=5):
29862997
"""
2987-
Returns last n rows
2998+
Return the last n rows.
2999+
3000+
Parameters
3001+
----------
3002+
n : int, default 5
3003+
Number of rows to select.
3004+
3005+
Returns
3006+
-------
3007+
obj_tail : type of caller
3008+
The last n rows of the caller object.
29883009
"""
3010+
29893011
if n == 0:
29903012
return self.iloc[0:0]
29913013
return self.iloc[-n:]

0 commit comments

Comments
 (0)