pyspark.pandas.groupby.GroupBy.sum

GroupBy.sum() → FrameLike

Compute sum of group values

Examples

>>> df = ps.DataFrame({"A": [1, 2, 1, 2], "B": [True, False, False, True],
...                    "C": [3, 4, 3, 4], "D": ["a", "b", "b", "a"]})
>>> df.groupby("A").sum()
   B  C
A
1  1  6
2  1  8