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.
This commit is contained in:
Yanchong Xu
2021-01-13 16:10:05 +08:00
committed by GitHub
parent 240cd2191c
commit e8c7e239d8

View File

@ -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])