So I have a Dataset which has a column containing name of colors(red, blue, green) and I want to convert these string values into int/float to fit into classifier. I was planning on using Python dictionary with keys as name of color and values as numbers. This was my code:
color_dict = {'red':1, 'blue':2, 'green':3}
for i in train['column_name']:
train['column_name'][i] = color_dict[i]
print(train['column_name'])
Sadly, this did not work. What should I do differently to make it work?