Sort a csv file in Python


I need to open and sort a csv data file in Rhino Python, I was going to use Pandas Data Frame module before I discovered that I cannot use it in IronPython so any advice of an alternative approach. I want to sort the data on various parameters ie the ID or X value etc ignoring the first 6 lines and the last line of the file. Test 8.txt (4.8 KB)

All help appreciated.


1 Like

Hello, you can use the csv module to read the file into a list of lists and then sort by a specific index : search google for list sorting by lambda function…

Hope this helps


Many thanks Graham.