bigframes.pandas.api.typing.DataFrameGroupBy.sum#
- DataFrameGroupBy.sum(numeric_only: bool = False, *args) DataFrame[source]#
Compute sum of group values.
Examples:
For SeriesGroupBy:
>>> lst = ['a', 'a', 'b', 'b'] >>> ser = bpd.Series([1, 2, 3, 4], index=lst) >>> ser.groupby(level=0).sum() a 3 b 7 dtype: Int64
For DataFrameGroupBy:
>>> data = [[1, 8, 2], [1, 2, 5], [2, 5, 8], [2, 6, 9]] >>> df = bpd.DataFrame(data, columns=["a", "b", "c"], ... index=["tiger", "leopard", "cheetah", "lion"]) >>> df.groupby("a").sum() b c a 1 10 7 2 11 17 [2 rows x 2 columns]
- Parameters:
- Returns:
Computed sum of values within each group.
- Return type: