I have a dataframe that looks similar to this.
age gender edu income
15 m MS <=50
16 f BS >50
17 m BS <=50
Since this is a binary problem, i'd like all the <=50K values to be 0 and >50K to be 1. I've tried replace method and it didn't do anything.
data["income"].replace(["<=50K"], "0", inplace = True)
data["income"].replace( to_replace = "<=50K"], value = 0, inplace = True)