Skip to content

Instantly share code, notes, and snippets.

@liannewriting
Last active October 19, 2021 15:30
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save liannewriting/71caa51ebbff16f821d75dfbb3836721 to your computer and use it in GitHub Desktop.
Save liannewriting/71caa51ebbff16f821d75dfbb3836721 to your computer and use it in GitHub Desktop.
python imbalanced data machine learning classification
df['Class'] = df['Class'].map(lambda x: 0 if x == 'negative' else 1)
df = pd.get_dummies(df, columns=['Sex'], drop_first=True)
df
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment