I want to sort my CSV file with the first column. The first column has strings in it but the values are numbers. So I want to sort it as an integer. I know I can sort using the following -
sortedList = sorted(mycsv, key=lambda t: float(t[0]))
But this gives the following error -
ValueError: invalid literal for float(): 14,481.72
I read a couple of SO questions like this and found out that the solution to get rid of that error is by doing this -
float(value.replace(',',''))
However I do not know how to do this while sorting using lambda function. I somehow cannot put this logic into the first line of code.