This might be a rather simple question - but I'm relatively new to python in my defense! Here's the case - I have loaded a CSV file into a list which looks something like this:
["4567", "59.0000", 7.0000", "1"]
["4567", "59.0000", 7.0000", "2"]
["4567", "59.0000", 7.0000", "5"]
["1234", "59.0000", 7.0000", "1"]
["1234", "59.0000", 7.0000", "2"]
["1234", "59.0000", 7.0000", "3"]
The first column is a unique id - where the last is number in the sequence which needs to be preserved (root of my problem).
I would like to order by the unique id (first row), but keep the sequences in order. So I would rather have the list like this
["1234", "59.0000", 7.0000", "1"]
["1234", "59.0000", 7.0000", "2"]
["1234", "59.0000", 7.0000", "3"]
["4567", "59.0000", 7.0000", "1"]
["4567", "59.0000", 7.0000", "2"]
["4567", "59.0000", 7.0000", "5"]
Obviously when I just sort on the unique id - the sequences gets messed up.
Is this a simple task to do all in one, or do I need to loop through the list twice? How can it be done? I'm pretty clueless. Thanks for your time!