尝试在Python中使用SARIMA进行预测后收到错误

我正在尝试使用python中的SARIMA进行预测。我正在遵循以下代码:https://github.com/gianfelton/SARIMA-Param-Search-for-Python 问题是当我尝试运行此代码时

 pred = best['model'].predict(start=test.index[0],end=test.index[-1],dynamic=True)

我收到此错误

KeyError: 'The `start` argument could not be matched to a location related to the index of the data.'

我的数据集有1585行,我的测试和训练值是:

train,test = dataset.iloc[:1268],dataset.iloc[1268:]

数据集如下:

                 time   emails_received
           2015-03-23   474483.0
           2015-03-24   378195.0

唯一的区别是我的数据集有一天的频率,而示例中的代码是一个月的频率。

在这里我如何设置频率

fa['time'] = pd.to_datetime(fa['time'])
fa['time']= fa.time.dt.date
fa.set_index('time',inplace=True)
fa.index.freq = 'D

在线上没有很多解释,我确实升级到了最新版的统计数学,并且我的数据中没有缺失的值。我花了几个小时解决这个问题,希望获得帮助。谢谢!

cg990942 回答:尝试在Python中使用SARIMA进行预测后收到错误

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3162389.html

大家都在问