MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Introduction to Polars

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

artist_means = (
    spotify_df
    # Group by artist and calculate average streams
    .group_by(____)
    .agg(____)
)

print(artist_means)
Edit dan Jalankan Kode