Broadcasting across rows
In the last set of exercises, you used monthly_industry_multipliers
, to create sales predictions. Recall that monthly_industry_multipliers
looks like this:
array([[0.98, 1.02, 1. ],
[1.00, 1.01, 0.97],
[1.06, 1.03, 0.98],
[1.08, 1.01, 0.98],
[1.08, 0.98, 0.98],
[1.1 , 0.99, 0.99],
[1.12, 1.01, 1. ],
[1.1 , 1.02, 1. ],
[1.11, 1.01, 1.01],
[1.08, 0.99, 0.97],
[1.09, 1. , 1.02],
[1.13, 1.03, 1.02]])
Assume you're not comfortable being so specific with your estimates. Rather, you'd like to use monthly_industry_multipliers
to find a single average multiplier for each industry. Then you'll use that multiplier to project next year's sales.
numpy
is loaded for you as np
, and the monthly_sales
and monthly_industry_multipliers
arrays are available. The monthly_sales
columns in order refer to liquor store, restaurant, and department store sales.
This exercise is part of the course
Introduction to NumPy
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Find the mean sales projection multiplier for each industry
mean_multipliers = ____
print(mean_multipliers)