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

Connected

练习

Group-by aggregation

You want to analyze the Spotify streaming data to understand which artists are most popular. Start with a simple group-by operation and then refine it to control the output order.

The spotify_df DataFrame is available for you.

说明 1 / 共 2 个

undefined XP
  • 1
    • Group the spotify_df by the "artist" column and calculate the .mean() number of streams for each artist.
  • 2
    • Now modify the group-by operation to maintain the order of artists as they appear in the original DataFrame.