scikit-learn 1 · Preprocessing and pipelines

Fill missing values

Replace missing values with the column median.

from sklearn.impute import SimpleImputer

imputer = SimpleImputer(strategy="median")
X_filled = imputer.fit_transform(X)

Official scikit-learn 1 documentation

More preprocessing and pipelines commands

All preprocessing and pipelines commands · scikit-learn 1 cheatsheet

Was this page helpful?