I have used SimpleImputer to change df but empty rows is still present. What did I do wrong?
from sklearn.impute import SimpleImputer
imp = SimpleImputer(missing_values=np.nan,strategy='most_frequent')
imp.fit_transform(df)
msno.matrix(df)
CodePudding user response:
fit_transform
is not in place transformation, it returns transformed object
from sklearn.impute import SimpleImputer
imp = SimpleImputer(missing_values=np.nan,strategy='most_frequent')
data_without_nans = imp.fit_transform(df)