pandas groupby index as column code example
Example 1: groupby as_index=false
When you use as_index=False , you indicate to groupby() that you don't want to set the column ID as the index (duh!). ... Using as_index=True allows you to apply a sum over axis=1 without specifying the names of the columns, then summing the value over axis 0.
Example 2: pandas groupby
data.groupby('month', as_index=False).agg({"duration": "sum"})