# data is a dataframe
for i in data.Sex[0:]:
if i == 'male':
i=1
print(i)
elif i == 'female':
i=0
print(i)
The output prints the column in what I intended it to be, changing male to 1 and female to 0. However, the i=1
and i=0
seemed to not have worked. If I run
print(data.Sex)
then nothing changed