modin.pandas.SeriesGroupBy.head¶
- SeriesGroupBy.head(n=5)[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.47.0/.tox/docs/lib/python3.9/site-packages/modin/pandas/groupby.py#L1421-L1431)¶
Return first n rows of each group.
Similar to
.apply(lambda x: x.head(n)), but it returns a subset of rows from the original DataFrame with original index and order preserved (as_indexflag is ignored).- Parameters:
n (int) – If positive: number of entries to include from the start of each group. If negative: number of entries to exclude from the end of each group.
- Returns:
Subset of the original Series or DataFrame as determined by n.
- Return type:
See also
Series.groupbyApply a function groupby to a Series.
DataFrame.groupbyApply a function groupby to each row or column of a DataFrame.
Examples