Open
Description
Feature Type
-
Adding new functionality to pandas
-
Changing existing functionality in pandas
-
Removing existing functionality in pandas
Problem Description
In [8]: df = pd.DataFrame({"col": list("aab"), "val": range(3)})
In [8]: df.groupby("col").agg(["sum", "min"])
Out[8]:
val
sum min
col
a 1 0
b 2 2
In [9]: df.groupby("col").transform(["sum", "min"])
TypeError: 'list' object is not callable
Feature Description
To get people out of the mindset of always using apply, it would be nice if .transform supported the same call signature as .agg
Additionally it would be great to support NamedAgg somehow in transform. The naming is a bit unfortunate...we could create a NamedTransform alias or maybe just live with the API inconsistency of:
.agg(col_a=NamedAgg("col", "sum"), ...)
.transform(col_a=NamedAgg("col", "cumsum"), ...)
I think either is still a net improvement over today
Alternative Solutions
n/a
Additional Context
No response