krishna
krishna

Reputation: 75

MICE implementation in python

I am trying to use MICE implementation using the following link:

Missing value imputation in python using KNN

from fancyimpute import MICE as MICE
df_complete=MICE().complete(df_train)

I am getting following error:

ufunc 'isnan' not supported for the input types, and the inputs could not be safely coerced to any supported types according to the casting rule ''safe''

On the link also, it says that they have replaced with NaN. I am not sure what does it mean? I have already tried: df_train.isnull(np.array([np.nan, 0], dtype=float)) but it is not helping either.

Upvotes: 1

Views: 17178

Answers (2)

goldenquidditch
goldenquidditch

Reputation: 1

This error usually happens when you deal with None values. Have you tried:

df_train.fillna(value=np.nan, inplace=True)

instead?

Upvotes: -6

krishna
krishna

Reputation: 75

df_train_numeric = df_train[['Age']].select_dtypes(include=[np.float]).as_matrix()
df_complete=MICE().complete(df_train_numeric)

Thanks to Data imputation with fancyimpute and pandas

Upvotes: 1

Related Questions