I am trying to make two one hot columns. I have in my df a column X_train["Sex"] which is either "male" or "female". I want to make a new column X_train["male"] with the value 1 if the "Sex" column was male and 0 if it was female (and the oposite in X_train["female"])
I tried this :
for sex in X_train["Sex"]:
if sex=="male":
X_train["male"]=1
X_train["female"]=0
else:
X_train["male"]=0
X_train["female"]=1
but i get this as a result :