from sklearn.impute import SimpleImputer imputer = SimpleImputer(strategy="median") imputed = imputer.fit_transform(numerical_df) numerical_df_imputed = pd.DataFrame(imputed, columns=numerical_df.columns, index=numerical_df.index) numerical_df_imputed
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