- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
尝试对频率不规则的时间序列数据应用seasonal_decompose。它看起来像这样:
modal_price
Period
2014-11-01 1469
2015-01-01 1258
2015-03-01 1112
2015-04-01 1373
2015-06-01 1370
2015-07-01 1406
2015-08-01 1520
2015-09-01 1860
2015-10-01 1436
2015-11-01 1455
当我使用 df.index.freq 时,freq 变为 None
当我像这样使用seasonal_decompose函数时:
seasonal_decompose(x, model = 'additive')
显示错误
ValueError: You must specify a freq or x must be a pandas object with a timeseries index with a freq not set to None.
需要帮助。
最佳答案
我遇到了同样的问题,并通过指定频率参数修复了它。
seasonal_decompose(Ts, model = 'additive', freq=1)
我希望这有帮助。我发现https://www.analyticsvidhya.com/blog/2016/02/time-series-forecasting-codes-python/有帮助。
关于python - None freq 不允许seasonal_decompose,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52979131/
我有一个要在Python中分解的时间序列信号,因此我转向statsmodels.seasonal_decompose()。我的数据频率为48(半小时)。我遇到了与this questioner相同的错
我正在使用 statsmodels 提供的季节性分解来分解多个时间序列。下面是代码和相应的输出: def seasonal_decompose(item_index): tmp = df2.l
一直在使用 Python 处理时间序列,并使用 sm.tsa.seasonal_decompose。在docs他们这样介绍功能: We added a naive seasonal decomposi
我正在尝试对我的 pandas 数据框执行 seasonal_decompose,但我遇到了一个我无法克服的错误。我的时间序列数据包含按时间顺序排列的差距,考虑到我的数据是股票价格,这是明智的(在市场
我有以下数据框,我称之为“sales_df”: Value Date 2004-01-01 0 2004-02-01 173 2004-
from statsmodels.tsa.seasonal import seasonal_decompose def seasonal_decomp(df, model="additiv
我是一名优秀的程序员,十分优秀!