statsmodels ETSModel get_prediction() returns error: “Object has not attribute ‘index'”

  Kiến thức lập trình

Here is my code:

import numpy as np
from statsmodels.tsa.exponential_smoothing.ets import ETSModel

vec = np.linspace(0,10, num = 50 )
ETS_model = ETSModel(vec,
    error="add",
    trend="add",
    #seasonal="add",
    damped_trend=True,
    )
ETS_fit = ETS_model.fit(maxiter=10000)
ETS_fit.get_prediction(start = 1, end = 10)

It returns the following error:

Traceback (most recent call last):

  Cell In[40], line 1
    ETS_fit.get_prediction(start = 1, end = 10)

  File ~AppDataLocalanaconda3envsenv1Libsite-packagesstatsmodelstsaexponential_smoothingets.py:2102 in get_prediction
    PredictionResults(

  File ~AppDataLocalanaconda3envsenv1Libsite-packagesstatsmodelstsaexponential_smoothingets.py:2263 in __init__
    self.row_labels = self.predicted_mean.index

AttributeError: 'numpy.ndarray' object has no attribute 'index'

What am I doing wrong?

LEAVE A COMMENT