I am trying to replace the values in a column with numbers. These are the unique values in the column:
['R2' '01' '02' 'C1']
So I did this
data = pd.read_csv('file.csv')
df = pd.DataFrame(data)
df['rates'].apply({'R2': 1, '01' : 2, '02' : 3, 'C1' : 4}.get)
But when I try to print out df['rates'] after the supposed replacement, I still got same values:
['R2' '01' '02' 'C1']
This is how my file.csv looks like
amount,id,rates,height
1400,4,R2,3
1389,6,R2,8
10000,1,01,13