Weighted Grade
parts has columns score and weight (positive numbers). Return the weighted average as a float: the sum of score * weight divided by the sum of the weights.
Example 1
parts {"score":[80,100],"weight":[1,3]}
returns 95.0
(80 + 300) / 4 = 95.0.
Constraints
- At least one row
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More pandas problems
- Words per RowEasy
- Above Department AverageMedium
- Above the Middle EverywhereMedium
- Average Experience per ProjectMedium
- Back the Next DayMedium
- Crosstab CountsMedium
- Customers Who Bought EverythingMedium
- Date Range FilterMedium