FunctionRacerProblemsRace

Top Earners per Department

MediumpandasPython

staff has columns name, dept and salary. For each department, find everyone who earns the highest salary in that department (several people can tie). Return a dictionary mapping each department to the alphabetically sorted list of those names.

Example 1

staff {"name":["ann","bo","cy"],"dept":["it","it","hr"],"salary":[90,90,50]}
returns {"hr":["cy"],"it":["ann","bo"]}

Ann and Bo tie in it.

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