bigframes.pandas.api.typing.SeriesGroupBy.head#

SeriesGroupBy.head(n: int = 5) Series[source]#

Return last first n rows of each group

Examples:

>>> df = bpd.DataFrame([[1, 2], [1, 4], [5, 6]],
...                   columns=['A', 'B'])
>>> df.groupby('A').head(1)
   A  B
0  1  2
2  5  6
[2 rows x 2 columns]
Parameters:

n (int) – If positive: number of entries to include from start of each group. If negative: number of entries to exclude from end of each group.

Returns:

First n rows of the original DataFrame or Series

Return type:

bigframes.pandas.DataFrame or bigframes.pandas.Series