Does anyone could tell me how to reorder the matrix:
[[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10],
[11, 12, 13, 14, 15]]
To:
[[15, 10, 5],
[14, 9, 4],
[13, 8, 3],
[12, 7, 2],
[11, 6, 1]]
>Solution :
Since you have tagged the question numpy, I surmise that those are numpy matrix, and you are looking for a numpy solution (otherwise, if those are lists, Ann’s zip is the correct solution).
For numpy you can
M[::-1,::-1].T
Example
M=np.array([[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10],
[11, 12, 13, 14, 15]])
M[::-1,::-1].T
returns
array([[15, 10, 5],
[14, 9, 4],
[13, 8, 3],
[12, 7, 2],
[11, 6, 1]])
as expected