from sklearn.impute import SimpleImputer imp = SimpleImputer(strategy=’constant’, fill_value=0) imp.fit_transform([[1, 2], [np.nan, 3]]) What is the output of this code?
Key points
- Constant strategy replaces missing values with a fixed scalar
- SimpleImputer returns float arrays by default
- np.nan is the standard representation for missing data
Ready to go further?
