I have this code:
from statsmodels.formula.api import OLS
The error is as follows:
ImportError: cannot import name 'OLS' from 'statsmodels.formula.api'
I tried updating statsmodels, but it does not work
I have this code:
from statsmodels.formula.api import OLS
The error is as follows:
ImportError: cannot import name 'OLS' from 'statsmodels.formula.api'
I tried updating statsmodels, but it does not work
The formula API always uses lower case since these are functions and not classes, and so you can use
from statsmodels.formula.api import ols
or the more canonical
import statsmodels.formula.api as smf
smf.ols("y ~ x", df)
© 2022 - 2024 — McMap. All rights reserved.
import statsmodels.api as sm; sm.OLS
? – Compunction