Skip to content

Instantly share code, notes, and snippets.

@Emekaborisama
Created November 7, 2022 20:02
Show Gist options
  • Save Emekaborisama/39e6161648cbf426132113b059a266dc to your computer and use it in GitHub Desktop.
Save Emekaborisama/39e6161648cbf426132113b059a266dc to your computer and use it in GitHub Desktop.
handle missing values
#handle missing values
from sklearn.impute import SimpleImputer
imp_ = SimpleImputer(missing_values=np.nan, strategy='most_frequent')
new_train_df = imp_.fit_transform(train_df)
new_train_df = pd.DataFrame(new_train_df, columns = train_df.columns)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment