#Check for null values in the data-set. If any, impute those missing values using simple imputer. (Hint: Use 'median' to impute)find out the mean of 'enginesize' after imputingimport pandas as pd import numpy as np # Importing the SimpleImputer class from sklearn.impute import SimpleImputer imputer = SimpleImputer(missing_values=np.NaN, strategy='median') df.enginesize = imputer.fit_transform(df['enginesize'].values.reshape(-1,1))[:,0] df['enginesize'].mean()
Friday, 27 November 2020
Imputer in Python
Labels:
Data Science,
Python
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment