Last active
April 24, 2018 11:18
-
-
Save Dssdiego/1067457ca2a26b336c5a5f1be8ef65a8 to your computer and use it in GitHub Desktop.
Useful to replace text with boolean value for A.I. code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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