From 47227ff9abee7afa9c7fb786e692c28686f31535 Mon Sep 17 00:00:00 2001 From: Joan Mora Grau Date: Sun, 28 Jun 2020 19:07:07 +0200 Subject: [PATCH] Update Day 1_Data PreProcessing.md According to the [docs](https://scikit-learn.org/stable/modules/generated/sklearn.impute.SimpleImputer.html#sklearn.impute.SimpleImputer) "New in version 0.20: SimpleImputer replaces the previous sklearn.preprocessing.Imputer estimator which is now removed." This change tries to update the way we handle missing values using scikit-learn. --- Code/Day 1_Data PreProcessing.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Code/Day 1_Data PreProcessing.md b/Code/Day 1_Data PreProcessing.md index 569d0e6..b3cce86 100644 --- a/Code/Day 1_Data PreProcessing.md +++ b/Code/Day 1_Data PreProcessing.md @@ -19,8 +19,8 @@ Y = dataset.iloc[ : , 3].values ``` ## Step 3: Handling the missing data ```python -from sklearn.preprocessing import Imputer -imputer = Imputer(missing_values = "NaN", strategy = "mean", axis = 0) +from sklearn.impute import SimpleImputer +imputer = SimpleImputer(missing_values = 0, strategy = "mean") imputer = imputer.fit(X[ : , 1:3]) X[ : , 1:3] = imputer.transform(X[ : , 1:3]) ```