Dssdiego
4/15/2018 - 6:04 PM

Replace column values

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)