File tree 1 file changed +61
-0
lines changed
1 file changed +61
-0
lines changed Original file line number Diff line number Diff line change @@ -3563,6 +3563,36 @@ def head(self, n=5):
3563
3563
-------
3564
3564
obj_head : type of caller
3565
3565
The first n rows of the caller object.
3566
+
3567
+ Examples
3568
+ --------
3569
+ >>> df = pd.DataFrame({'animal':['falcon', 'parrot', 'lion',
3570
+ ... 'monkey', 'shark', 'bee', 'bear']})
3571
+ >>> df
3572
+ animal
3573
+ 0 falcon
3574
+ 1 parrot
3575
+ 2 lion
3576
+ 3 monkey
3577
+ 4 shark
3578
+ 5 bee
3579
+ 6 bear
3580
+
3581
+ Viewing the last 5 lines (the default)
3582
+ >>> df.head()
3583
+ animal
3584
+ 0 falcon
3585
+ 1 parrot
3586
+ 2 lion
3587
+ 3 monkey
3588
+ 4 shark
3589
+
3590
+ Viewing the last n lines (three in this case)
3591
+ >>> df.head(3)
3592
+ animal
3593
+ 0 falcon
3594
+ 1 parrot
3595
+ 2 lion
3566
3596
"""
3567
3597
3568
3598
return self .iloc [:n ]
@@ -3580,6 +3610,37 @@ def tail(self, n=5):
3580
3610
-------
3581
3611
obj_tail : type of caller
3582
3612
The last n rows of the caller object.
3613
+
3614
+ Examples
3615
+ --------
3616
+ >>> df = pd.DataFrame({'animal':['falcon', 'parrot', 'lion',
3617
+ ... 'monkey', 'shark', 'bee', 'bear']})
3618
+ >>> df
3619
+ animal
3620
+ 0 falcon
3621
+ 1 parrot
3622
+ 2 lion
3623
+ 3 monkey
3624
+ 4 shark
3625
+ 5 bee
3626
+ 6 bear
3627
+
3628
+ Viewing the last 5 lines (the default)
3629
+ >>> df.tail()
3630
+ animal
3631
+ 2 lion
3632
+ 3 monkey
3633
+ 4 shark
3634
+ 5 bee
3635
+ 6 bear
3636
+
3637
+ Viewing the last n lines (three in this case)
3638
+ >>> df.tail(3)
3639
+ animal
3640
+ 4 shark
3641
+ 5 bee
3642
+ 6 bear
3643
+
3583
3644
"""
3584
3645
3585
3646
if n == 0 :
You can’t perform that action at this time.
0 commit comments