gpt4 book ai didi

python - None freq 不允许seasonal_decompose

转载 作者:行者123 更新时间:2023-12-01 01:29:59 25 4
gpt4 key购买 nike

尝试对频率不规则的时间序列数据应用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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com