Skip to content

Commit f6363ca

Browse files
committed
DOC: Adding example to head and tail method (#16416)
1 parent a9f5ad9 commit f6363ca

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

pandas/core/generic.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -3563,7 +3563,7 @@ def head(self, n=5):
35633563
-------
35643564
obj_head : type of caller
35653565
The first n rows of the caller object.
3566-
3566+
35673567
Examples
35683568
--------
35693569
>>> df = pd.DataFrame({'animal':['falcon', 'parrot', 'lion',
@@ -3577,7 +3577,7 @@ def head(self, n=5):
35773577
4 shark
35783578
5 bee
35793579
6 bear
3580-
3580+
35813581
Viewing the last 5 lines (the default)
35823582
>>> df.head()
35833583
animal
@@ -3586,7 +3586,7 @@ def head(self, n=5):
35863586
2 lion
35873587
3 monkey
35883588
4 shark
3589-
3589+
35903590
Viewing the last n lines (three in this case)
35913591
>>> df.head(3)
35923592
animal
@@ -3610,7 +3610,7 @@ def tail(self, n=5):
36103610
-------
36113611
obj_tail : type of caller
36123612
The last n rows of the caller object.
3613-
3613+
36143614
Examples
36153615
--------
36163616
>>> df = pd.DataFrame({'animal':['falcon', 'parrot', 'lion',
@@ -3624,23 +3624,23 @@ def tail(self, n=5):
36243624
4 shark
36253625
5 bee
36263626
6 bear
3627-
3628-
Viewing the last 5 lines (the default)
3629-
>>> df.tail()
3627+
3628+
Viewing the last 5 lines (the default)
3629+
>>> df.tail()
36303630
animal
36313631
2 lion
36323632
3 monkey
36333633
4 shark
36343634
5 bee
36353635
6 bear
3636-
3637-
Viewing the last n lines (three in this case)
3638-
>>> df.tail(3)
3636+
3637+
Viewing the last n lines (three in this case)
3638+
>>> df.tail(3)
36393639
animal
36403640
4 shark
36413641
5 bee
36423642
6 bear
3643-
3643+
36443644
"""
36453645

36463646
if n == 0:

0 commit comments

Comments
 (0)