1>>> import numpy as np
2>>> a = np.array([[10, 20, 30, 40, 50],
3... [ 6, 7, 8, 9, 10]])
4>>> permutation = [0, 4, 1, 3, 2]
5>>> idx = np.empty_like(permutation)
6>>> idx[permutation] = np.arange(len(permutation))
7>>> a[:, idx] # return a rearranged copy
8array([[10, 30, 50, 40, 20],
9 [ 6, 8, 10, 9, 7]])
10>>> a[:] = a[:, idx] # in-place modification of a