Let's suppose I have an array as such:
np.array([1., 1., 0.],
[0., 4., 0.],
[8., 0., 8.],
[0., 0., 0.],
[5., 0., 0.],
[2., 2., 2.]])
With column[0] summing to 16, column[1] to 6 and column[2] to 10.
How do I efficiently in Numpy re-arrange the array by column value greatest to least? In the above example, column[0] would remain in place and column[1] and column[2] would switch positions.
np.array(list(zip(*sorted(zip(*arr), key=sum,reverse=True))))