使用数据minig进行价格预测

时间:2016-11-25 10:21:06

标签: python pandas statistics compression

我有数据框

    (index)     purchased   sold        price
2013-04-04  14.865494   14.800361   12.762369
2013-04-05  15.191654   15.296572   12.777120
2013-04-06  15.402671   15.844089   12.773146
2013-04-07  15.840517   15.437765   12.780774

且索引为df.index

DatetimeIndex(['2013-04-04', '2013-04-05', '2013-04-06', '2013-04-07',
           '2013-04-08', '2013-04-09', '2013-04-11', '2013-04-12',
           '2013-04-14', '2013-04-15',
           dtype='datetime64[ns]', name='date',length=273,freq=None)

我需要编写一个模型来使用分解来减少数据中的季节性: 我写了这段代码:

from statsmodels.tsa.seasonal import seasonal_decompose
decomposition = seasonal_decompose(df)

trend = decomposition.trend
seasonal = decomposition.seasonal
residual = decomposition.resid

但它会引发decomposition = seasonal_decompose(df)

的错误
  

ValueError:您必须指定freq或x必须是带有时间序列索引的pandas对象

有什么问题? 还有其他办法吗?

0 个答案:

没有答案