RJT1990 / pyflux

Open source time series library for Python
BSD 3-Clause "New" or "Revised" License
2.1k stars 240 forks source link

plot_predict : 'module' object has no attribute 'indexes' #112

Closed alireza-akhondi-asl closed 6 years ago

alireza-akhondi-asl commented 6 years ago

When I run the ARMAX example: http://pyflux.readthedocs.io/en/latest/arimax.html I get the following error from model.plot_predict(h=10,oos_data=data.iloc[-12:],past_values=100,figsize=(15,5)) : File "/usr/local/lib/python2.7/dist-packages/pyflux/arma/arimax.py", line 778, in plot_predict date_index = self.shift_dates(h) File "/usr/local/lib/python2.7/dist-packages/pyflux/tsm.py", line 536, in shift_dates if isinstance(date_index, pd.core.indexes.datetimes.DatetimeIndex): AttributeError: 'module' object has no attribute 'indexes'

dioh commented 6 years ago

Same thing is happening to me

Kevin-Deng-2021 commented 6 years ago

I have the same issue.

model = pf.ARIMA(data=df3, ar=10, ma=5, integ=0, target='sold_num') The 'model' object looks correct and functional, but once I use 'predict' attribution.

df_predict = model.predict_is(h=30) It shows the error: 'module' object has no attribute 'indexes'

I can run the same script on my other operating system without showing any error. I try to uninstall and install pyflux again, but it cannot work. Is there any conflict happen?

dioh commented 6 years ago

I succeded by monkey patching.

Here is my solution:

pd.core.indexes.datetimes.DatetimeIndex = pd.DatetimeIndex

RJT1990 commented 6 years ago

Which pandas version are you using?

dioh commented 6 years ago

In [1]: import pandas pa In [2]: pandas.version Out[2]: u'0.20.3'

"En economía no hay nada misterioso ni inaccesible al entendimiento del hombre de la calle. Si hay un misterio, reside él en el oculto propósito que puede perseguir el economista y que no es otro que la disimulación del interés concreto a que se sirve."

A. Jauretche

On Thu, Sep 28, 2017 at 12:53 PM, Ross Taylor notifications@github.com wrote:

Which pandas version are you using?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/RJT1990/pyflux/issues/112#issuecomment-332880998, or mute the thread https://github.com/notifications/unsubscribe-auth/AAQsotFGnmuPXFv4zC3mPuJgLLsK9xnTks5sm8EFgaJpZM4PKeOE .

RJT1990 commented 6 years ago

Okay this may be an issue with PyFlux's support for pandas 0.20.3 (and DatetimeIndex module treatment). I'll have a look in the next few days and push out a new version of the library. Thank you for reporting!

RJT1990 commented 6 years ago

(And apologies for late response, but have been tied down with work so not a lot of time to maintain this library recently!)

dioh commented 6 years ago

No problem, I monkey patch it as follows:

class Object(object): pass

pd.core.indexes = Object()
pd.core.indexes.datetimes = Object()
pd.core.indexes.datetimes.DatetimeIndex = pd.DatetimeIndex

Let me know if you want me to make a pull request for you.

In another line of thoughts I would like to ask you something about pyflux VAR method and latent variables calculation. IRC is an option for you?

RJT1990 commented 6 years ago

Thanks guys I am looking at this now - first time I've had a chance to review the library in a while.

RJT1990 commented 6 years ago

Tried with pandas version - '0.21.0' - plot_predict is working for me. Could you upgrade to latest pandas version and reopen this issue if it still raises the same AttributeError for you.