Home > database >  Make the grouped by rows a part of the data frame
Make the grouped by rows a part of the data frame

Time:03-26

The following code results in the following output \

mean = df.groupby("Group").mean()enter image description here

How can I make so the 'Group' column is part of the data frame rather than a simple index aka enter image description here

CodePudding user response:

you can use the parameter "as_index" in the groupby function

mean = df.groupby("Group", as_index = False).mean()
  • Related