FunctionRacerProblemsRace

Sort by Two Columns

EasypandasPython

staff has columns name, dept and salary. Return the list of names ordered by dept alphabetically; within a department, higher salaries come first; if salaries tie, order by name alphabetically.

Example 1

staff {"name":["a","b","c"],"dept":["it","hr","it"],"salary":[50,10,70]}
returns ["b","c","a"]

hr first; in it, c (70) before a (50).

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