tfcausalimpact
tfcausalimpact copied to clipboard
AttributeError: 'NoneType' object has no attribute 'loc'
I am using the following code and the error persists. The thing is that a week ago the code was working just fine with the exact same Dataframe:
import pandas as pd
from causalimpact import CausalImpact
data = pd.read_csv('https://raw.githubusercontent.com/WillianFuks/tfcausalimpact/master/tests/fixtures/arma_data.csv')[['y', 'X']]
data.iloc[70:, 0] += 5
pre_period = [0, 69]
post_period = [70, 99]
ci = CausalImpact(data, pre_period, post_period)
print(ci.summary())
print(ci.summary(output='report'))
ci.plot()
Pandas version is 2.1.3 and causalimpact version is 0.2.6
Hi @benji931122 ,
tfci does not have version 0.2.6. Apparently in your workflow at some point you are installing another ci package. tfcausalimpact
should be present in your pip freeze
and no other package with conflicting name should appear as well.
Thanks! It does show up only once when I do the pip freeze. What can I do to use this library as intended?
So you'll have to uninstall the current package that you have and install again tfci via pip install -U tfcausalimpact
. After that you could run: pip show tfcausalimpact
and it should return something like
Name: tfcausalimpact
Version: 0.0.14
Summary: Python version of Google's Causal Impact model on top of Tensorflow Probability.
Home-page: https://github.com/WillianFuks/tfcausalimpact
Author: Willian Fuks
Author-email: willian<dot>fuks<at>gmail.com
License: Apache License 2.0
Location: path/to/package
Requires: jinja2, pandas, tensorflow, tensorflow-probability, matplotlib
Required-by: