Mean & median imputation
Imputing missing values is the best method when you have large amounts of data to deal with. The simplest methods to impute missing values include filling in a constant or the mean of the variable or other basic statistical parameters like median and mode.
In this exercise, you'll impute the missing values with the mean and median for each of the columns. The DataFrame diabetes has been loaded for you. SimpleImputer() from sklearn.impute has also been imported for you to use.
Diese Übung ist Teil des Kurses
<Kurs>Dealing with Missing Data in Python</Kurs>Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Make a copy of diabetes
diabetes_mean = diabetes.copy(deep=True)
# Create mean imputer object
mean_imputer = SimpleImputer(___=___)
# Impute mean values in the DataFrame diabetes_mean
diabetes_mean.iloc[:, :] = mean_imputer.___(___)