1. Learn
  2. /
  3. Courses
  4. /
  5. Dealing with Missing Data in Python

Connected

Exercise

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.

Instructions 1/2

undefined XP
  • 1
    • Create a SimpleImputer() object while performing mean imputation.
    • Impute the copied DataFrame.
  • 2
    • Create a SimpleImputer() object while performing median imputation.
    • Impute the copied DataFrame.