Closed shr264 closed 7 years ago
@shr264 This troubles me too...... copy and paste,but failed at "predict" step. Anyone work through the examples? Many thanks.
Likely a versioning issue (which version of pandas you are using).
I'll see if I can push out an update that fixes this (along with some changes to the matplotlib library that affect functionality) in the near future, but unfortunately I cannot promise anything as I am very tied down with other work right now.
Hey, I'm going to take a look at this today :)
This is now fixed and is going to be in the release I am going to push in next 2 hours. Issue was a change in the pandas library modules for indexes. Now fixed, and will reflect this change in the version requirements.
Hi,
I am getting the following error in trying to replicate the example on http://www.pyflux.com/docs/arimax.html: Traceback (most recent call last):
File "", line 28, in
model.plot_predict(h=10, oos_data=data.iloc[-12:], past_values=100, figsize=(15,5))
File "/anaconda/envs/python3/lib/python3.6/site-packages/pyflux/arma/arimax.py", line 778, in plot_predict date_index = self.shift_dates(h)
File "/anaconda/envs/python3/lib/python3.6/site-packages/pyflux/tsm.py", line 537, in shift_dates if isinstance(date_index,pd.tseries.index.DatetimeIndex):
AttributeError: module 'pandas.tseries' has no attribute 'index'
Below is the code, which I have copied verbatim from the page:
import numpy as np import pandas as pd import pyflux as pf from datetime import datetime import matplotlib.pyplot as plt
data = pd.read_csv("https://vincentarelbundock.github.io/Rdatasets/csv/MASS/drivers.csv") data.index = data['time']; data.loc[(data['time']>=1983.05), 'seat_belt'] = 1; data.loc[(data['time']<1983.05), 'seat_belt'] = 0; data.loc[(data['time']>=1974.00), 'oil_crisis'] = 1; data.loc[(data['time']<1974.00), 'oil_crisis'] = 0; plt.figure(figsize=(15,5)); plt.plot(data.index,data['drivers']); plt.ylabel('Driver Deaths'); plt.title('Deaths of Car Drivers in Great Britain 1969-84'); plt.plot();
type(data['drivers'])
model = pf.ARIMAX(data=data, formula='drivers~1+seat_belt+oil_crisis', ar=1, ma=1, family=pf.Normal()) x = model.fit("MLE") x.summary()
model.plot_fit(figsize=(15,10))
model.plot_predict(h=10, oos_data=data.iloc[-12:], past_values=100, figsize=(15,5))