1 Head and Tail
To view a small sample of a Series or DataFrame object, use the
head()
and tail()
methods. The default number
of elements to display is five, but you may pass a custom number.
In [1]: long_series = pd.Series(np.random.randn(1000))
In [2]: long_series.head()
Out[2]:
0 -0.305384
1 -0.479195
2 0.095031
3 -0.270099
4 -0.707140
dtype: float64
In [3]: long_series.tail(3)
Out[3]:
997 0.588446
998 0.026465
999 -1.728222
dtype: float64