class DataFrame_numerical_Imputer(): def __init__(self): print("numerical_Imputer object created") def KNN_Imputer(self,df): """ This method is for imputation, behalf of all methods KNN imputation performs well, hence this method will helps to impute missing values in dataset """ knn_imputer = KNNImputer(n_neighbors=5) df.iloc[:, :] = knn_imputer.fit_transform(df) return df
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter