GroupBy—Transform and Filter
Learn how to apply transform and filter functions on grouped data.
Overview of transform
Having seen how to aggregate grouped data, we'll now switch gears and learn how to apply transform functions. In general, the transform operation applies a function to each group, and the resulting scalar value is then assigned to each row of every group.
When used on grouped data, transform functions perform group-wise computations and return an output indexed the same way as the original DataFrame. Let’s use the credit card dataset to illustrate how this works on grouped data.
Get hands-on with 1400+ tech skills courses.