The pandas data frame that I was working with has a column with string entries and I wish to convert it to integers.
The column is called diagnosis and each row has a value of either M or B. I wanted to convert all M to 1 and all B to 0 with the following code
for row in data['diagnosis']:
if row == 'M':
row = 1
else:
row = 0
But it does not change anything?