July 2019
Beginner to intermediate
740 pages
16h 52m
English
We already know that we have some missing values in our planet data, so let's see what scikit-learn offers us for imputing. Currently, they only have two options in the impute module: imputing with a value (using constants or summary statistics) or indicating what is missing.
Back in the Exploratory data analysis section, we ran dropna() on the planet data we planned to model with. Let's say we don't want to get rid of it, and we want to try imputing it instead. The last few rows of our data have some missing values for semimajoraxis:
| semimajoraxis | mass | eccentricity | |
|---|---|---|---|
| 3809 | 0.0487 | 1.0770 | 0.00 |
| 3810 | 0.0815 | 1.9000 | 0.00 |
| 3811 | NaN | 0.3334 | 0.31 |
| 3812 | NaN | 0.4000 | 0.27 |
| 3813 | NaN | 0.4200 | 0.16 |
We can use the SimpleImputer to impute ...
Read now
Unlock full access