0

When I run the below code:

from statsmodels.regression import rolling

I get this error message:

AttributeError Traceback (most recent call last) /var/folders/q9/_s10_9yx6k7gxt3w4t7j0hgw0000gn/T/ipykernel_56663/1581398632.py in ----> 1 from statsmodels.regression import rolling

~/opt/anaconda3/lib/python3.8/site-packages/statsmodels/regression/rolling.py in 456 457 --> 458 class RollingRegressionResults(object): 459 """ 460 Results from rolling regressions

~/opt/anaconda3/lib/python3.8/site-packages/statsmodels/regression/rolling.py in RollingRegressionResults() 514 515 @cache_readonly --> 516 @Appender(RegressionResults.aic.func.doc) 517 def aic(self): 518 return self._wrap(RegressionResults.aic.func(self))

AttributeError: 'pandas._libs.properties.CachedProperty' object has no attribute 'func'

I've never had this problem before and I'm unsure what has gone wrong. I'm running statsmodels version 0.12.2 and Python 3.8.12 on MacOS 11.4. I'm trying to use RollingOLS.

Thanks for your help.

EDIT: Out of curiosity I just replaced all '.func' with '' in this file and this issue no longer exists and the results seem to be accurate. I don't really understand what this did however and since I'm using this in a professional capacity I need to be sure this is correct.

4
  • 1
    Hmm, version 0.13.2 works fine for me (macOS 12.1). Commented Feb 21, 2022 at 16:48
  • Maybe you have some code that's overwriting some builtin code? Can you post all your code in your file/notebook? Commented Feb 21, 2022 at 16:49
  • Seems to be an issue with 0.12.2, when I updated to 0.13.2 it works fine. The fix for 0.12.2 seemed to be removing all '.func' from the code. Thanks for your help. Commented Feb 21, 2022 at 17:09
  • You have a version of pandas installed that was released after 0.12.2 was released. Removal of the func attribute create the error. You can do one of two things. 1. Upgrade to statsmodels 0.13.x (probably .2). 2. Downgrade to a version of pandas that was available when statsmodels 0.12.2 was released, which would be pandas 1.2.x. Commented Feb 22, 2022 at 11:27

3 Answers 3

0

I can't reproduce this issue with macOS 12.1 - it's likely a problem with your code / system setup.

However, 0.13.2 seems to work.

Sign up to request clarification or add additional context in comments.

Comments

0

I was getting the same error when I was trying to import statsmodels.tsa.arima_model that has been removed & replaced by statsmodels.tsa.arima.model.

The steps I followed to troubleshoot the error are:

  1. Updating pandas using this command: pip install --upgrade pandas --user

  2. Updating statsmodels using this command: pip install --upgrade statsmodels --user

  3. After that I got the below error:

    NotImplementedError: statsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have been removed in favor of statsmodels.tsa.arima.model.ARIMA (note the . between arima and model) and statsmodels.tsa.SARIMAX.

    statsmodels.tsa.arima.model.ARIMA makes use of the statespace framework and is both well tested and maintained. It also offers alternative specialized parameter estimators.

Then I resolved the error by replacing statsmodels.tsa.arima_model with statsmodels.tsa.arima.model .

Comments

0

statsmodels.tsa.arima_model.ARMA and statsmodels.tsa.arima_model.ARIMA have been removed in favor of statsmodels.tsa.arima.model.ARIMA (note the . between arima and model) and statsmodels.tsa.SARIMAX.

statsmodels.tsa.arima.model.ARIMA makes use of the statespace framework and is both well tested and maintained. It also offers alternative specialized parameter estimators.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.