cudf.core.groupby.groupby.GroupBy.transform#
- GroupBy.transform(function)#
Apply an aggregation, then broadcast the result to the group size.
- Parameters:
- function: str or callable
Aggregation to apply to each group. Note that the set of operations currently supported by transform is identical to that supported by the agg method.
- Returns:
- A Series or DataFrame of the same size as the input, with the
- result of the aggregation per group broadcasted to the group
- size.
See also
Examples
import cudf df = cudf.DataFrame({'a': [2, 1, 1, 2, 2], 'b': [1, 2, 3, 4, 5]}) df.groupby('a').transform('max') b 0 5 1 3 2 3 3 5 4 5