[Python] statsmodel.SARIMAX .forecast() method do not execute

Discussão em 'Python' iniciado por Stack, Janeiro 17, 2025.

  1. Stack

    Stack Membro Participativo

    I am trying to use SARIMAX model for TS forecasting. However, I got some kind of error i dont know how to handle. My code is simple:

    import statsmodels.api as sm

    fit = sm.tsa.statespace.SARIMAX(train).fit()
    sarima = fit.forecast()


    train data looks like

    y
    ds
    2015-01-07 1
    2015-01-14 64
    2015-01-21 16
    2015-01-28 50
    2015-02-04 7


    I got the error

    /usr/local/lib/python3.6/dist-packages/statsmodels/tsa/base/datetools.py in
    _date_from_idx(d1, idx, freq)
    84 offset. For now, this needs to be taken care of before you get
    here.
    85 """
    ---> 86 return _maybe_convert_period(d1) + int(idx) *
    _freq_to_pandas[freq]
    87
    88

    TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'


    Any ideas what I am doing wrong?

    Continue reading...

Compartilhe esta Página