We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
df = pd.DataFrame({'a': [1, 1, 2], 'b': [3, 4, 5]}) gb = df.groupby('a', as_index=False)['b'] result = gb.agg(["sum", "mean"]) print(result) # sum mean # a # 1 7 3.5 # 2 5 5.0
In the output, a should be a column rather than in the index.
a