Sort by Two Columns
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
- The tables are small
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Split Full NameEasy
- Stack Two TablesEasy
- Teams Above AverageEasy
- Time per EmployeeEasy
- Triangle JudgementEasy
- Weekday CountsEasy
- Weighted GradeEasy
- Words per RowEasy