Concepts: we have to replace the missing data as the mean value by its all of features.
At first we can replace the missing field by "NAN"
for that we need ,
Step 01: from sklearn.impute import SimpleImputer
Step 02: #create object of Imputer class
imputer = SimpleImputer(missing_values= np.NAN, strategy= 'mean', fill_value=None, verbose=0, copy=True)
Step 03: #fitting imputer objects in matrix
imputer = imputer.fit(X[: , 1:3])
Here , X defines the which columns missing value will be replaced
Step 04: Transform the fitting ,
X[:, 1:3] = imputer.transform(X[:, 1:3])
Step 05: Find the output by print X
print(X)
Top comments (0)