6. Groupby
Group the Data in the DataFrame
Click Groupby in the Data Analysis category.
DataFrame: Select the dataframe you want to group by.
Groupby: Group data based on the values in the selected column. For time-related data, check out Grouper to group data based on time periods like monthly, weekly, or yearly.
Columns: Select the columns you want to group by applying the criteria you selected in Group by.
Method: Choose the information you want to see in the grouped data.
For example, if you choose mean, you'll see the average value for each group. If you want to see different information for each group, use Advanced.
Allocate to: Specify a variable name to assign to the result. Check Reset Index to ignore the existing index and assign a new one. Check To DataFrame to save the result in dataframe format.
Code View: Preview the code that will be output.
Data View: Preview the output that will be printed.
Run: Print and run the code.
Last updated