跨行广播
在上一组练习中,您使用了 monthly_industry_multipliers 来创建销售预测。回忆一下,monthly_industry_multipliers 如下所示:
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]])
假设您不想把估计做得这么具体。相反,您希望使用 monthly_industry_multipliers 为每个行业找到一个单一的平均乘数。然后用该乘数来预测明年的销售额。
已为您导入 numpy 为 np,并提供了 monthly_sales 和 monthly_industry_multipliers 数组。monthly_sales 的列按顺序对应酒类商店、餐馆和百货商店的销售额。
本练习是课程的一部分
NumPy 入门
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Find the mean sales projection multiplier for each industry
mean_multipliers = ____
print(mean_multipliers)