ARIMA预测错误

时间:2017-03-23 02:46:10

标签: python

我创建了一个pandas DataFrame来使用arima模型并预测一些数据:

def get_data_frame(sales):
    dates = []
    sales = []
    for x in sales:
        dates.append(medida.date)
        sales.append(medida.sale)

    data_frame = pd.DataFrame(cobros, index=fechas)
    return data_frame

这给了我以下数据框:

                                    0
DATE                                 
2012-01-01 00:00:00+00:00        0.00
2012-01-02 00:00:00+00:00  1428665.98
2012-01-03 00:00:00+00:00  1959110.61
2012-01-04 00:00:00+00:00  1835208.91
2012-01-05 00:00:00+00:00  1826139.51

然后我打电话给:

from statsmodels.tsa.arima_model import ARIMA
model = ARIMA(timeseries, order=(1, 1, 1))

但我收到以下错误:

/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.pyc in __new__(cls, endog, order, exog, dates, freq, missing)
    998         else:
    999             mod = super(ARIMA, cls).__new__(cls)
-> 1000             mod.__init__(endog, order, exog, dates, freq, missing)
   1001             return mod
   1002 

/usr/local/lib/python2.7/dist-packages/statsmodels/tsa/arima_model.pyc in __init__(self, endog, order, exog, dates, freq, missing)
   1022             self.exog = self.exog[d:]
   1023         if d == 1:
-> 1024             self.data.ynames = 'D.' + self.endog_names
   1025         else:
   1026             self.data.ynames = 'D{0:d}.'.format(d) + self.endog_names

TypeError: ufunc 'add' did not contain a loop with signature matching types dtype('S21') dtype('S21') dtype('S21')

有谁能告诉我如何修复此错误以及为什么会发生此错误?

0 个答案:

没有答案