Skip to content

Instantly share code, notes, and snippets.

@Dssdiego
Last active April 24, 2018 11:18
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 Dssdiego/1067457ca2a26b336c5a5f1be8ef65a8 to your computer and use it in GitHub Desktop.
Save Dssdiego/1067457ca2a26b336c5a5f1be8ef65a8 to your computer and use it in GitHub Desktop.
Useful to replace text with boolean value for A.I. code
# Replaces Male -> 0
df['sex'] = df['sex'].replace('Male', 0)
# Replaces Female -> 1
df['sex'] = df['sex'].replace('Female', 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment