Practice / window functions

Dense Standings

medium

An arcade leaderboard ranks players by score, and ties should share a place with no gaps in the numbering.

scores

Your task: return player, points, and a standing — a dense ranking over points from highest to lowest. Players with equal points share a standing, and standings never skip a number (so the score just below a tie is one higher, not two).

Assign your answer DataFrame to result. Row order doesn't matter.

scoresinput DataFrame

Schema
columntype
playerstring
pointslong
Sample rows
playerpoints
Ada30
Ben30
Cara20
Dan10
Expected output shape
playerpointsstanding· 4 rows
Hint

F.dense_rank().over(Window.orderBy(F.col("points").desc())). Tied players share a standing, and — unlike rank() — the next distinct score is only one higher, never skipping a number.

Lesson refresher

This problem builds on Window Functions (~9 min). Pop it open in a new tab if you want a quick recap.

Loading editor…
Hit Run to execute your code and see the output here.