0
import numpy as np
import pyflux as pf
import pandas as pd
import matplotlib.pyplot as plt


BTC_df = pd.read_csv('BTC1.csv')
BTC_df = BTC_df.iloc[:,[5]]
    #BTC_df = BTC_df['close']
BTC_returns = 100 * (np.log(BTC_df) - np.log(BTC_df.shift(1)))
BTC_returns = BTC_returns.dropna()
x = BTC_df.to_numpy()
plt.figure(figsize=(15,5))
plt.plot(BTC_returns)

plt.show()

model = pf.GAS(ar=2, sc=2, data= BTC_returns, family=pf.Poisson())
x = model.fit()
x.summary()

This is my code and I get the above error , there is no issue with the date and I’ve installed the pyflux package , pip install pyflux. I’m using spyder in anaconda. I’m not sure how to fix it . My data are Bitcoin returns over the past 5 years , daily data. The error is raised in the package, and it says return object.getattribute(self,name) And data_check .. transformed_data = data.ix[:,0].values

https://i.stack.imgur.com/LlSkZ.jpg

Anna
  • 11
  • 2
  • 2
    Please post the entire traceback message. Its not immediately obvious where this error is raised. – tdelaney Apr 23 '22 at 15:42
  • 1
    And add a small example of your CSV data so we have something to work with. – tdelaney Apr 23 '22 at 15:43
  • Could it be related to that? https://stackoverflow.com/questions/59991397/attributeerror-dataframe-object-has-no-attribute-ix – Michał Apr 23 '22 at 15:44
  • Unfortunately its not related , the data doesn’t have any issue . I was thinking maybe the GAS pancake has an issue. My data is thr Bitcoin returns but it’s a huge file – Anna Apr 23 '22 at 15:48
  • 1
    Please [edit] your quesiton to include the **entire** error message as someone already asked. – Code-Apprentice Apr 23 '22 at 15:54
  • I’ve added the error – Anna Apr 23 '22 at 15:55
  • No, you've added a summary of the error. The traceback would tell us the line that failed and where in your code it was called. @Michal referred you to a question that seems highly relevant - if code is trying to use "ix" on a dataframe, either its old code using a feature that's been removed from pandas, or you are expecting a column called "ix". But we don't have a small example of your data or the line of code that fails. – tdelaney Apr 23 '22 at 16:06
  • I added a picture because typing it is maybe not so clear – Anna Apr 23 '22 at 16:15
  • `pip install pyflux` would get [pyflux on pypi.org](https://pypi.org/project/pyflux/) which I think is [RJT1990/pyflux on github](https://github.com/rjt1990/pyflux). It seems like it hasn't been updated in 5 years. Maybe there is a more up to date fork? – tdelaney Apr 23 '22 at 16:38
  • I installed pyflux but unfortunately this is the only package and there are no others for the GAS model for python – Anna Apr 23 '22 at 20:15

1 Answers1

0

I believe the issue is that pyflux is using a pandas function that was removed, see this issue someone mentioned on their repo:

https://github.com/RJT1990/pyflux/issues/160

So, maybe you could try installing an archival version of pandas and python and run it there (pyflux is compatible with python 3.5 from what I've read).

Michał
  • 124
  • 5
  • I looked at it but unfortunately I don’t see anything , I have installed pandas and my version is 3.8 – Anna Apr 23 '22 at 15:54
  • 1
    I think your pandas version is too new to be compatible with pyflux and that you should create an environment with an older version of pandas. You could try pandas 0.20.2 as pyflux requirements file mentions it https://github.com/RJT1990/pyflux/blob/master/requirements.txt Essentially pandas 1.0.0 release removed the ix function: https://pandas.pydata.org/pandas-docs/dev/whatsnew/v1.0.0.html – Michał Apr 23 '22 at 15:58