【问题标题】:Importing stldecompose result in error - cannot import name '_maybe_get_pandas_wrapper_freq' from 'statsmodels.tsa.filters._utils'导入 stldecompose 导致错误 - 无法从“statsmodels.tsa.filters._utils”导入名称“_maybe_get_pandas_wrapper_freq”
【发布时间】:2020-09-12 17:38:19
【问题描述】:

我的代码

!pip install stldecompose

from stldecompose import decompose

错误消息


ImportError Traceback(最近一次调用最后一次) 在 2 # 通过 PIP 安装库 3 get_ipython().system('pip install stldecompose') ----> 4 from stldecompose 导入分解,预测

~/opt/anaconda3/lib/python3.7/site-packages/stldecompose/init.py ----> 1 from .stl import 分解,预测

~/opt/anaconda3/lib/python3.7/site-packages/stldecompose/stl.py 3 从 pandas.core.nanops 导入 nanmean 作为 pd_nanmean 4 从 statsmodels.tsa.seasonal 导入 DecomposeResult ----> 5 来自 statsmodels.tsa.filters._utils 导入 _maybe_get_pandas_wrapper_freq 6 将 statsmodels.api 导入为 sm 7

ImportError: cannot import name '_maybe_get_pandas_wrapper_freq' from 'statsmodels.tsa.filters._utils' (/Users/georgeng/opt/anaconda3/lib/python3.7/site-packages/statsmodels/tsa/filters/_utils.py )

【问题讨论】:

    标签: python statsmodels


    【解决方案1】:

    你有两条途径可以解决这个问题:

    1. 如果您正在运行 statsmodels==0.11.0,则 statsmodels.tsa.filters._utils 函数已从库中删除。

    您也可以使用statsmodels.tsa.seasonal.STL,它提供了类似的功能。查看它的文档: https://www.statsmodels.org/stable/generated/statsmodels.tsa.seasonal.STL.html#statsmodels.tsa.seasonal.STL

    1. 降级到pip install statsmodels==0.10.2

    【讨论】:

    猜你喜欢
    • 2022-01-27
    • 2021-09-10
    • 2020-04-17
    • 1970-01-01
    • 2022-06-21
    • 2022-12-08
    • 2022-11-29
    • 2023-01-22
    • 2023-01-19
    相关资源
    最近更新 更多