From e8c7e239d8238b18c9ab3461a2e18cb81befafb4 Mon Sep 17 00:00:00 2001 From: Yanchong Xu <60683403+yx-xyc@users.noreply.github.com> Date: Wed, 13 Jan 2021 16:10:05 +0800 Subject: [PATCH] Update Day 1_Data_Preprocessing.py On line 20, the input of missing_value should be np.nan. This is the default of this function in the newest version of sklearn. --- Code/Day 1_Data_Preprocessing.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Code/Day 1_Data_Preprocessing.py b/Code/Day 1_Data_Preprocessing.py index d81deb2..a6c8ed3 100644 --- a/Code/Day 1_Data_Preprocessing.py +++ b/Code/Day 1_Data_Preprocessing.py @@ -17,7 +17,7 @@ print(Y) #Step 3: Handling the missing data # If you use the newest version of sklearn, use the lines of code commented out # from sklearn.impute import SimpleImputer -# imputer = SimpleImputer(missing_values="NaN", strategy="mean") +# imputer = SimpleImputer(missing_values=np.nan, strategy="mean") from sklearn.preprocessing import Imputer imputer = Imputer(missing_values = "NaN", strategy = "mean", axis = 0) imputer = imputer.fit(X[ : , 1:3])