@@ -3564,35 +3564,39 @@ def head(self, n=5):
3564
3564
obj_head : type of caller
3565
3565
The first n rows of the caller object.
3566
3566
3567
+ See Also
3568
+ --------
3569
+ pandas.DataFrame.tail
3570
+
3567
3571
Examples
3568
3572
--------
3569
- >>> df = pd.DataFrame({'animal':['falcon ', 'parrot ', 'lion ',
3570
- ... 'monkey ', 'shark ', 'bee ', 'bear ']})
3573
+ >>> df = pd.DataFrame({'animal':['bear ', 'bee ', 'falcon ',
3574
+ ... 'lion ', 'monkey ', 'parrot ', 'shark ']})
3571
3575
>>> df
3572
3576
animal
3573
- 0 falcon
3574
- 1 parrot
3575
- 2 lion
3576
- 3 monkey
3577
- 4 shark
3578
- 5 bee
3579
- 6 bear
3577
+ 0 bear
3578
+ 1 bee
3579
+ 2 falcon
3580
+ 3 lion
3581
+ 4 monkey
3582
+ 5 parrot
3583
+ 6 shark
3580
3584
3581
3585
Viewing the last 5 lines (the default)
3582
3586
>>> df.head()
3583
3587
animal
3584
- 0 falcon
3585
- 1 parrot
3586
- 2 lion
3587
- 3 monkey
3588
- 4 shark
3588
+ 0 bear
3589
+ 1 bee
3590
+ 2 falcon
3591
+ 3 lion
3592
+ 4 monkey
3589
3593
3590
3594
Viewing the last n lines (three in this case)
3591
3595
>>> df.head(3)
3592
3596
animal
3593
- 0 falcon
3594
- 1 parrot
3595
- 2 lion
3597
+ 0 bear
3598
+ 1 bee
3599
+ 2 falcon
3596
3600
"""
3597
3601
3598
3602
return self .iloc [:n ]
@@ -3611,35 +3615,39 @@ def tail(self, n=5):
3611
3615
obj_tail : type of caller
3612
3616
The last n rows of the caller object.
3613
3617
3618
+ See Also
3619
+ --------
3620
+ pandas.DataFrame.head
3621
+
3614
3622
Examples
3615
3623
--------
3616
3624
>>> df = pd.DataFrame({'animal':['falcon', 'parrot', 'lion',
3617
3625
... 'monkey', 'shark', 'bee', 'bear']})
3618
3626
>>> df
3619
3627
animal
3620
- 0 falcon
3621
- 1 parrot
3622
- 2 lion
3623
- 3 monkey
3624
- 4 shark
3625
- 5 bee
3626
- 6 bear
3628
+ 0 bear
3629
+ 1 bee
3630
+ 2 falcon
3631
+ 3 lion
3632
+ 4 monkey
3633
+ 5 parrot
3634
+ 6 shark
3627
3635
3628
3636
Viewing the last 5 lines (the default)
3629
3637
>>> df.tail()
3630
3638
animal
3631
- 2 lion
3632
- 3 monkey
3633
- 4 shark
3634
- 5 bee
3635
- 6 bear
3639
+ 2 falcon
3640
+ 3 lion
3641
+ 4 monkey
3642
+ 5 parrot
3643
+ 6 shark
3636
3644
3637
3645
Viewing the last n lines (three in this case)
3638
3646
>>> df.tail(3)
3639
- animal
3640
- 4 shark
3641
- 5 bee
3642
- 6 bear
3647
+ animal
3648
+ 4 monkey
3649
+ 5 parrot
3650
+ 6 shark
3643
3651
3644
3652
"""
3645
3653
0 commit comments