在干净的 anaconda 安装上使用 statsmodels 时出现 AttributeError
AttributeError when using statsmodels on clean anaconda installation
我正在使用 statsmodels 包对 Anaconda(今天下载)进行全新安装,对 macOS Catalina 进行完全全新安装。
然而,运行
import statsmodels.formula.api as smf
import pandas as pd
weekly_df = pd.read_csv('Data/Weekly.csv')
form = 'Direction_Up ~ Lag1 + Lag2 + Lag3 + Lag4 + Lag5 + Volume'
model_10b = smf.Logit.from_formula(formula = form, data = weekly_df)
我收到错误
module 'statsmodels.formula.api' has no attribute 'Logit'
根据类似问题中的早期建议,这似乎是安装问题。我试图修复它,在 conda 上重新安装 statsmodels(conda install statsmodels),但这并没有解决它。我删除并重新安装了 Anaconda,也没有解决它。
这可能是什么问题?非常感谢您的帮助。
请您运行在 Anaconda Prompt 中使用以下命令安装 statsmodels
conda install -c anaconda statsmodels
它对我有用:)
这将从 statsmodels 导入所有模块。
I get the error
module statsmodels.formula.api
has no attribute Logit
这不是安装问题。 formula.api
不再包含大写字母 Logit
。它已被删除以避免与小写 logit
混淆
大写 Logit
是 class 的名称,数据必须以数组或 pandas DataFrame 的形式提供。
formula.api
中的小写 logit
采用公式和 DataFrame 或字典来定义模型和数据。这只是 Logit
class.
的 from_formula
方法的方便别名
我正在使用 statsmodels 包对 Anaconda(今天下载)进行全新安装,对 macOS Catalina 进行完全全新安装。
然而,运行
import statsmodels.formula.api as smf
import pandas as pd
weekly_df = pd.read_csv('Data/Weekly.csv')
form = 'Direction_Up ~ Lag1 + Lag2 + Lag3 + Lag4 + Lag5 + Volume'
model_10b = smf.Logit.from_formula(formula = form, data = weekly_df)
我收到错误
module 'statsmodels.formula.api' has no attribute 'Logit'
根据类似问题中的早期建议,这似乎是安装问题。我试图修复它,在 conda 上重新安装 statsmodels(conda install statsmodels),但这并没有解决它。我删除并重新安装了 Anaconda,也没有解决它。
这可能是什么问题?非常感谢您的帮助。
请您运行在 Anaconda Prompt 中使用以下命令安装 statsmodels
conda install -c anaconda statsmodels
它对我有用:)
这将从 statsmodels 导入所有模块。
I get the error module
statsmodels.formula.api
has no attributeLogit
这不是安装问题。 formula.api
不再包含大写字母 Logit
。它已被删除以避免与小写 logit
大写 Logit
是 class 的名称,数据必须以数组或 pandas DataFrame 的形式提供。
formula.api
中的小写 logit
采用公式和 DataFrame 或字典来定义模型和数据。这只是 Logit
class.
from_formula
方法的方便别名