Manager Names
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
- At least one person has a manager
- Every manager_id that is not None is an id in the table
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Most Orders CustomerMedium
- Most Recent OrderMedium
- Person CitiesMedium
- Rearrange Products TableMedium
- Record ReadingsMedium
- Reformat Department TableMedium
- Revenue per ProductMedium
- Rising TemperatureMedium