I am very new to Python. I have this list called 'prediction' with results from an LDA classification problem. The elements in 'prediction' are string, which I want to convert to numeric values. I am doing it by brute-force like:
aux2 = [0]*len(prediction)
i = 0
for k in prediction:
if k == 'ALA':
aux2[i] = 1
elif k == 'ARG':
aux2[i] = 2
elif k == 'ASN':
aux2[i] = 3
elif k == 'ASP':
aux2[i] = 4
...
elif k == 'VAL':
aux2[i] = 18
i = i+1
But I am sure there is a better way to do it. Please put me out of my ignorance!