Skip to content
ml-recall

#simple-imputer

1 question from Data & Features

Timed test

1 question · 1 min · score and explanations at the end

Take a test
Q 1 / 1Score 0 / 0

Question 1: Short answer

easyAI-checkedData & Features

What does this print?

import numpy as np
from sklearn.impute import SimpleImputer

train = np.array([[22.0], [38.0], [np.nan], [26.0], [35.0]])   # ages
test = np.array([[np.nan], [50.0]])

imputer = SimpleImputer(strategy="median").fit(train)
print(imputer.transform(test)[0, 0])

A number, e.g. 12.5