I have created a 2D matrix like this:
45 67 Row Fine
25 22 Abe Real
58 54 Abe Noon
Each column is a list. The values in the rows are connected together, so the values in the third row with the indexnumber 2 belong to each other.
I want to sort the rows, first on the third row, and then on the fourth row, so that it becomes:
58 54 Abe Noon
25 22 Abe Real
45 67 Row Fine
I don't know what way to go. I could sort one list, the one with the values of the third column. Then find out the new indexnumbers and compare them with the old. Then I could adjust the other lists as well, so that all rows are correct again. But then I still need to sort the fourth row.
I see some code for sorting a list of lists here , but I then need lists of rows instead of columns (if I understand it well).
Or is creating a dictionary a smart way to go?