有人能帮忙吗?这是我的密码。
df_ci = pd.DataFrame(df_ig.groupby(['Tanggal'])['INTERACTIONS IG'].sum())
df_ci这就是数据文件的样子。
互动IG
唐加尔
2021-12-02 74.0
2021-12-03 326.0
2021-12-14 51.0
... ...
2022-05-30 80.0
2022-05-31 270.0
然后,我使用了因果影响包。
pre = ['2021-12-02', '2022-02-28']
post = ['2022-03-01', '2022-05-31']
from causalimpact import CausalImpact
ci = CausalImpact(df_ci["INTERACTIONS IG"], pre, post)
ci.summary()当我想显示对因果影响的总结、图解和推论时,它得到了一个错误:
~\AppData\Roaming\Python\Python38\site-packages\causalimpact\analysis.py in summary(self, output, width, path)
727 confidence = "{}%".format(int((1 - alpha) * 100))
728 post_period = self.params["post_period"]
--> 729 post_inf = self.inferences.loc[post_period[0] : post_period[1], :]
730 post_point_resp = post_inf.loc[:, "response"]
731 post_point_pred = post_inf.loc[:, "point_pred"]
AttributeError: 'NoneType' object has no attribute 'loc'请帮帮我,谢谢。
发布于 2022-09-15 14:49:26
在ci.run()之前打电话给ci.summary()。
ci = CausalImpact(df_ci["INTERACTIONS IG"], pre, post)
ci.run() # Add this
ci.summary()https://stackoverflow.com/questions/73021255
复制相似问题