python - 使用 STL 分解时间序列会出错
问题描述
我的代码
stl_fcast = forecast(nottem_stl, steps=12, fc_func=seasonal_naive, seasonal = True)
错误信息
ValueError Traceback (most recent call last)
<ipython-input-95-39c1ef0e911d> in <module>
1 stl_fcast = forecast(nottem_stl, steps=12, fc_func=seasonal_naive,
----> 2 seasonal = True)
3
4 stl_fcast.head()
~/opt/anaconda3/lib/python3.7/site-packages/stldecompose/stl.py in forecast(stl, fc_func, steps, seasonal, **fc_func_kwargs)
102
103 # forecast index starts one unit beyond observed series
--> 104 ix_start = stl.observed.index[-1] + pd.Timedelta(1, stl.observed.index.freqstr)
105 forecast_idx = pd.DatetimeIndex(freq=stl.observed.index.freqstr,
106 start=ix_start,
pandas/_libs/tslibs/timedeltas.pyx in > pandas._libs.tslibs.timedeltas.Timedelta.__new__()
ValueError: Units 'M' and 'Y' are no longer supported, as they do not represent unambiguous timedelta values durations.
此代码曾经在旧版本的 Pandas - 0.25 中工作。
感谢任何帮助,谢谢。
解决方案
推荐阅读
- python - Spark 2.4.x:地图中的重复键
- db2 - DB2 删除尾随 0 和
- android - Google Fit:无法实时更新步数、距离和 move_minutes
- python - 正确使用函数调用作为默认参数
- c# - OpenAPI - 在定义中包含派生类型
- pandas - Pandas 根据用户输入的列名和值选择行
- c# - 如何访问其他脚本的值而不会出现此错误:CS0120:非静态字段需要对象引用?
- python - 对包含列表的字典列表中的值进行排序
- php - Google drive API V3 在不使用服务帐户的情况下使用 php 将文件复制到另一个驱动器
- components - Blazor 服务器 - 不继承共享视图的组件