1. Learn
  2. /
  3. Courses
  4. /
  5. Introduction to Polars

Connected

Exercise

Multiple Aggregations on a Column

You want to analyze the Spotify streaming data to understand how streaming patterns vary across different years and artists. You start with a basic group-by operation and then expand it to include multiple statistics.

The spotify_df DataFrame is available for you.

Instructions 1/2

undefined XP
  • 1
    • Group spotify_df by both "year" and "artist" columns and calculate the .mean() number of streams for each combination.
  • 2
    • Calculate both the mean and maximum streams for each year & artist. Name the columns with "_mean" and "_max" suffixes.