Average Experience per Project
assignments has columns project and emp (an employee on a project). staff has columns emp and years (years of experience). Return a dictionary mapping each project to the average years of experience of its employees.
Example 1
assignments {"project":["p1","p1","p2"],"emp":[1,2,2]}
staff {"emp":[1,2],"years":[3,5]}
returns {"p1":4.0,"p2":5.0}
p1: (3 + 5) / 2 = 4.0. p2: 5.0.
Constraints
- Every employee in
assignmentsis instaff
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Back the Next DayMedium
- Crosstab CountsMedium
- Customers Who Bought EverythingMedium
- Date Range FilterMedium
- Deepest Fall per TickerMedium
- Department HeadcountMedium
- Earning More Than the ManagerMedium
- Employee BonusMedium