pandas.Series.head¶
Return the first n rows.
This function returns the first n rows for the object based on position. It is useful for quickly testing if your object has the right type of data in it.
- param n
- int, default 5
Number of rows to select.
- return
obj_head : same type as caller The first n rows of the caller object.
Examples¶
import pandas as pd
from numba import njit
@njit
def series_head():
s = pd.Series([7, 6, 5, 4, 3, 2, 1], index=[0, 2, 4, 6, 8, 10, 12])
return s.head(3)
print(series_head())
$ python ./series/series_head.py
0 7
2 6
4 5
dtype: int64
See also