6. Groupby

Group the Data in the DataFrame

  1. Click Groupby in the Data Analysis category.


  1. DataFrame: Select the dataframe you want to group by.

  2. 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.

  3. Columns: Select the columns you want to group by applying the criteria you selected in Group by.

  4. Method: Choose the information you want to see in the grouped data.

    1. 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.

  5. 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.

  6. Code View: Preview the code that will be output.

  7. Data View: Preview the output that will be printed.

  8. Run: Print and run the code.

Last updated