Having a dataframe df with the columns id,price and units like so
id | price | units
---+-------+--------
1 | 10 | 1
1 | 15 | 4
1 | 13 | 3
2 | 5 | 12
2 | 1 | 20
I can apply multiple functions to specific columns like
df.groupby("id").agg({"price":["mean","max"], "units":["mean","max"])
Since we have max and mean twice, it might be nice to rename them (I am aware that the output is a multicolumn-index) to be able to tell the difference.
Normally when using .agg we can specify the name like df.groupby("id")["price"](max_price="max") but it does not seem to work the same way when parsing a dict e.g
df.groupby("id").agg({"price":[(mean_price="mean"),(max_price="max")],
"units":[(mean_unit="mean"),(max_unit="max")]})