FunctionRacerProblemsRace

Manager Names

MediumpandasPython

staff has columns id, name and manager_id. manager_id is the id of the person's manager, or None for the boss. Names are unique. Return a dictionary mapping the name of each person who has a manager to the name of that manager.

Example 1

staff {"id":[1,2,3],"name":["Ann","Bo","Cy"],"manager_id":[null,1,2]}
returns {"Bo":"Ann","Cy":"Bo"}

Bo reports to Ann and Cy reports to Bo.

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