google / google/CausalImpact

I can't get summury from date indexing data: 'NoneType' object has no attribute 'loc'

Open
#64 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
R
Stars
1.9k
Forks
264
PR merge metrics
No merged PRs in 30d

Description

The source code is following. I ran example code in google colab.
import pandas as pd
from causalimpact import CausalImpact

data = pd.read_csv('https://raw.githubusercontent.com/WillianFuks/tfcausalimpact/master/tests/fixtures/comparison_data.csv', index_col=['DATE'])
pre_period = ['2019-04-16', '2019-07-14']
post_period = ['2019-7-15', '2019-08-01']
ci = CausalImpact(data, pre_period, post_period)

pd.__version__
1.5.2
print(ci.summary())

AttributeError Traceback (most recent call last)
[](https://localhost:8080/#) in
----> 1 print(ci.summary())

[/usr/local/lib/python3.8/dist-packages/causalimpact/analysis.py](https://localhost:8080/#) 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'

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.