![](/img/trans.png)
[英]How to get predictions using X-13-ARIMA in python statsmodels
[英]how to perform X-12-ARIMA statsmodels on resampled dataframe
我遵循此 statsmodels X-12-ARIMA實現的示例 ,在我的情況下,我的數據框看起來像
668 2000/01/28 20:00:00 1.476667
669 2000/01/28 21:00:00 1.715498
670 2000/01/28 22:00:00 1.713599
671 2000/01/28 23:00:00 1.733763
我需要分析,我有兩個月的數據,所以我想每月重新采樣。 我使用以下代碼:
df.index=pd.to_datetime(df.ts)
df=df.resample('M')
print df
res = sm.tsa.x13_arima_select_order(df.value)
我不確定要了解print的輸出:
DatetimeIndexResampler [freq=<MonthEnd>, axis=0, closed=right, label=right, convention=start, base=0]
和最后一行代碼的以下錯誤:
x13_arima_analysis中的文件412行的文件“ home / .virtualenvs / local / lib / python2.7 / site-packages / statsmodels-0.8.0-py2.7-linux-x86_64.egg / statsmodels / tsa / x13.py” ValueError(“如果endog不是”,則start和freq不能為空ValueError:如果endog不是熊貓的對象,start和freq不能為無
我猜問題出在我的數據集中,但我無法弄清楚到底出了什么問題。 您能否幫助我理解問題,以及如何繼續處理該錯誤?
嘗試這個:
df.ts = pd.to_datetime(df.ts)
res = df.set_index('ts')['value'].resample('M').apply(sm.tsa.x13_arima_select_order)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.