I'm trying to do some aggregations on a pandas data frame. Here is a sample code:
import pandas as pddf = pd.DataFrame({"User": ["user1", "user2", "user2", "user3", "user2", "user1"],"Amount": [10.0, 5.0, 8.0, 10.5, 7.5, 8.0]})df.groupby(["User"]).agg({"Amount": {"Sum": "sum", "Count": "count"}})Out[1]: Amount Sum CountUser user1 18.0 2user2 20.5 3user3 10.5 1
Which generates the following warning:
FutureWarning: using a dict with renaming is deprecated and will be removed in a future version return super(DataFrameGroupBy, self).aggregate(arg, *args, **kwargs)
How can I avoid this?