调整季节性的频率

时间:2019-06-12 11:22:13

标签: python time-series statsmodels

在重新采样的帮助下,我调整了数据以运行statsmodels的Season_decompose,我的原始索引是datetime列:

df2 = df2.set_index('Timeindex')
y = df2['Target'].resample('W').sum()
rcParams['figure.figsize'] = 18, 8

decomposition = sm.tsa.seasonal_decompose(y, model='additive')
fig = decomposition.plot()
plt.show()

因此,到目前为止,我的工作是将我或多或少的每日数据(某些日期丢失)与每周数据相加,该图中的观察图有效,趋势图也有效,但季节性图有效丢失。

我的原始数据是52年,为期2年,因此,如果设置了,总共有104个数据点:

decomposition = sm.tsa.seasonal_decompose(y, model='additive', freq=52)

它也是空的,那么在这种情况下正确的频率是什么?

图形如下:Analysing Time Series in Python - pandas formatting error - statsmodels

但季节部分为空。

如果我对“月度”数据进行重新采样时采用相同的方法,则该方法将完全正常工作。

0 个答案:

没有答案
相关问题