snowflake.snowpark.modin.plugin.extensions.groupby_overrides.DataFrameGroupBy.size¶
- DataFrameGroupBy.size()[source] (https://github.com/snowflakedb/snowpark-python/blob/v1.26.0/snowpark-python/src/snowflake/snowpark/modin/plugin/extensions/groupby_overrides.py#L888-L904)¶
Compute group sizes.
- Returns:
Number of rows in each group as a Series if as_index is True or a
DataFrame
if as_index is False.- Return type:
DataFrame
or Series
Examples
>>> data = [[1, 2, 3], [1, 5, 6], [7, 8, 9]] >>> df = pd.DataFrame(data, columns=["a", "b", "c"], ... index=["owl", "toucan", "eagle"]) >>> df a b c owl 1 2 3 toucan 1 5 6 eagle 7 8 9 >>> df.groupby("a").size() a 1 2 7 1 dtype: int64
For SeriesGroupBy:
>>> data = [[1, 2, 3], [1, 5, 6], [7, 8, 9]] >>> df = pd.DataFrame(data, columns=["a", "b", "c"], ... index=["owl", "toucan", "eagle"]) >>> df a b c owl 1 2 3 toucan 1 5 6 eagle 7 8 9 >>> df.groupby("a")["b"].size() a 1 2 7 1 Name: b, dtype: int64