FunctionRacerProblemsRace

Dense Rank Scores

EasypandasPython

scores has a column score. Give each row a dense rank: the highest score has rank 1, the next different score has rank 2, and equal scores share a rank with no gaps afterwards. Return the list of ranks in row order.

Example 1

scores {"score":[90,70,90,50]}
returns [1,2,1,3]

90 is rank 1, 70 rank 2, 50 rank 3.

Constraints

Race itor take your time

Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.

More pandas problems