Rank Players by Score

Medium
Window Functions
Ranking
LinkedIn
Airbnb

Rank Players by Score

Rank players by score descending using dense_rank (ties share the same rank). Return player_id, score, rank sorted by rank asc then player_id asc.

Sample input

player_idscore
160
2100
370
480
590
650
Browser Engine: Evaluates PySpark DataFrame & SQL logic locally in Pyodide WebAssembly.

Input data

1 DataFrame

These DataFrames are passed to solve(spark, dfs). Access one with dfs['name'].

df.players8 rows
player_id (int)score (int)
160
2100
370
480
590
650
7100
850

Return these columns

player_id(int)
score(int)
rank(int)

Column names and order must match. Sort order is specified in the question.

Browser engine
Loading Python editor…
Click Run to try the sample cases, or Submit to check the hidden cases. First run caches the browser Python engine (~8–15s once); all code stays on your device.