I am working with a dataframe with entirely numeric data, except 1 column which is labelled 'diagnosis', which has either an 'M' or a 'B'.
I wish to relabel all the B's as 0's and all the M's as 1's, but my code is not saving the results in the dataframe:
entries = df['diagnosis']
for i in entries:
if i == 'B':
i = 0
else:
i = 1
How can I achieve this and save the dataframe with the newly labelled data?