需要安全预案吗?
一家商店想根据他们在 2023 年黑色星期五(全年最大的促销活动)预计的买家数量,判断是否需要升级安全规范。店内的最大容纳人数上限为 250。每年黑色星期五,这家店都会请每位买家为他们的购物体验打分,而您正好拿到了这份数据。
调查数据集 foot_traffic 已为您清洗并加载。它包含列:year、visitors 和 average_experience_rating。
statsmodels.api 包已以 sm 导入,同时还导入了 matplotlib.pyplot 为 plt、pandas 为 pd,以及 numpy 为 np。
本练习是课程的一部分
使用 Python 分析调查数据
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Define variable, x and y
x = foot_traffic.____.____
y = foot_traffic.____.____
# Add the constant term
x = ____.____(x)
# Perform .OLS() regression and fit
result = ____.____(y,x).____()
# Print the summary table
print(____.____())