1. Learn
  2. /
  3. Courses
  4. /
  5. Data Transformation with Polars

Connected

Exercise

Ranking albums with tie handling

Your record company publishes an internal leaderboard each week based on the Spotify dataset. Tie handling can change how artists are perceived - several albums share the same listener counts, so you need to compare how different ranking methods handle ties.

polars is loaded as pl. The DataFrame spotify with streaming metrics is preloaded for you.

Instructions

100 XP
  • Create a ranking of monthly_listeners in descending order, aliasing as rank_default.
  • Add a second ranking with leaderboard-style tie handling, aliasing as rank_min.