BaşlayınÜcretsiz başlayın

Counting genre popularity

To find the most common genres across the catalog, reshape the genres list column so each genre lands on its own row, then compute a sorted value count to see which genres top the list.

The movies DataFrame is preloaded for you.

Bu egzersiz, kursun bir parçasıdır

Scaling and Optimizing Data Pipelines with Polars

Kursa Göz Atın

Egzersiz talimatları

  • Explode the genres list column so each genre has its own row.
  • Compute the top 10 most common genres using a sorted value count.

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

# Put each genre on its own row
genres = movies.select("genres").____("genres")["genres"]

# Rank by frequency
result = genres.drop_nulls().____(sort=True).head(10)
print(result)
Kodu Düzenle ve Çalıştır