pandas DataFrame df
包含以下信息:
df
Date Param1
0 2011-12-21 55.12
1 2011-12-28 70.12
2 2012-01-04 33.73
3 2012-01-11 53.14
4 2012-01-18 74.16
为了能够使用ARIMA我将日期转换如下:
dates = dates_from_range('2011m1', length=len(df.Param1))
df.index = dates
df = df[['Param1']]
from statsmodels.tsa.arima_model import ARIMA
res = ARIMA(df, (1,0,0), freq='M').fit()
然而,在这种情况下,我没有得到正确的日期序列,而是得到了这个:
Date Param1
2011-01-31 55.12
2011-02-29 70.12
2011-03-31 33.73
2011-04-30 53.14
2011-05-31 74.16
如何避免使用dates_from_range
并手动构建日期?