TypeError: from_for...
 
Notifications
Clear all

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

2 Posts
1 Users
0 Likes
3,613 Views
amrit_3327
(@amrit_3327)
Trusted Member
Joined: 4 years ago
Posts: 65
Topic starter  

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 4 years ago by amrit_3327

   
Quote
amrit_3327
(@amrit_3327)
Trusted Member
Joined: 4 years ago
Posts: 65
Topic starter  

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: