Building multi-regression model throws error: `Pandas data cast to numpy dtype of object. Check input data with np.asarray(data).`
If X is your dataframe, try using the .astype
method to convert to float when running the model:
est = sm.OLS(y, X.astype(float)).fit()
if both y(dependent) and X are taken from a data frame then type cast both:-
est = sm.OLS(y.astype(float), X.astype(float)).fit()
This is because you have NOT generated the dummy values step to all predictors so how can the regression take place over literals ? that is what the error message is saying it is trying to convert to numpy valid entries.
Just go back to your pipeline and include the dummies properly.