Notifications
Clear all

TypeError: from_formula() missing 2 required positional arguments: 'formula' and 'data'  

  RSS

amrit_3327
(@amrit_3327)
Trusted Member
Joined: 9 months ago
Posts: 53
15/01/2020 10:25 pm  

regressor_OLS =sm.ols(endog=y, exog=X_opt).fit()

TypeError: from_formula() missing 2 required positional arguments: 'formula' and 'data'

This topic was modified 8 months ago by amrit_3327

Quote
amrit_3327
(@amrit_3327)
Trusted Member
Joined: 9 months ago
Posts: 53
15/01/2020 10:26 pm  

Guys this module is part of Linear_model class so use following code to make it work.

import statsmodels.regression.linear_model as lm X = np.append(arr=np.ones((50,1)).astype(int),values=X,axis=1)

X_opt = X[:,[0,1,2,3,4,5]]

regressor_OLS = lm.OLS(endog = y, exog = X_opt).fit()


ReplyQuote
Share: