1. 学习
  2. /
  3. 课程
  4. /
  5. Introduction to Polars

Connected

练习

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.

说明 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.