【问题标题】:Index(...) must be called with a collection of some kind, 'seasonal' was passed Error while trying decomposition in time seriesIndex(...) 必须使用某种集合调用,\'seasonal\' 传递错误,同时尝试在时间序列中分解
【发布时间】:2022-10-18 11:33:47
【问题描述】:

我有一个包含天气数据的时间序列数据集。

我使用以下代码将日期列设置为索引

data = data.set_index("date")
data

它运行没有任何错误

现在我正在尝试使用以下代码进行分解

import statsmodels.api as sm
decomposition = sm.tsa.seasonal_decompose(data, model = 'additive', period = 2)
fig = decomposition.plot()
matplotlib.rcParams['figure.figsize'] = [9.0, 5.0]

我收到了这个错误:

TypeError: Index(...) must be called with a collection of some kind, 'seasonal' was passed 

我能做些什么?

【问题讨论】:

    标签: python time-series


    【解决方案1】:

    我在搜索相同的错误时发现了这一点——请参阅对我有帮助的 [this answer][1]

    【讨论】:

      猜你喜欢
      • 2021-05-31
      • 2020-12-02
      • 2022-06-15
      • 2016-11-30
      • 2017-12-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-07-02
      相关资源
      最近更新 更多