Python
#46

Ranking Methods in Pandas: min, max, first, dense

MediumAmazon
Interview Question #46
Asked at Amazon

Given duplicate salary values, compute rankings using `method='dense'` and `method='min'`. Explain how each handles ties.

Input Table: salaries
4 rows preview
namesalary
Aarav100
Bhavna90
Chirag90
Divya80
Expected Output Structure4 rows
namesalaryrank_denserank_min
Aarav10011
Bhavna9022
Chirag9022
Divya8034
Interview Context

Asked frequently in data analyst and business analyst technical rounds. Focus on clean filtering, optimal indexing usage, and unambiguous column selection.

Python 3.10 (Pandas)
Environment Ready

Click "Run & Test" to execute your Pandas code against the test assertions.

Chat with us