susanli2016 / Machine-Learning-with-Python

Python code for common Machine Learning Algorithms
4.25k stars 4.81k forks source link

Logistic regression #9

Open eysdevteam opened 5 years ago

eysdevteam commented 5 years ago

Hi, in have a problem with the implementation of lr when i try it... _logitmodel=sm.Logit(y,X) i get it... ValueError: Pandas data cast to numpy dtype of object. Check input data with np.asarray(data)

panchiwalashivani commented 3 years ago

Firstly, you have to fit that to a stasmodel like:

est = sm.OLS(y, X).fit()

It throws:

Pandas datacast to numpy dtype of object. Check input data with np.asarray(data).

I converted all the dtypes of the DataFrame using

df.convert_objects(convert_numeric=True)

After this, all dtypes of data frame variables appear as int32 or int64. But in the end it still shows dtype: object

viv2712 commented 2 years ago

can you send me the sample....so I can recreate the problem....