Вы можете наверняка нарезать B
векторизованным способом. Вы даже можете сделать это без временного создания массива индекса:
D = B[:,np.argsort(A, axis=0)]
Более подробный вывод
In [13]: A
Out[13]: array([40, 1, 12, 42, 15, 3])
In [14]: B
Out[14]:
array([[43, 20, 26, 15, 24, 13],
[36, 7, 47, 14, 36, 11],
[44, 19, 41, 32, 14, 43],
[27, 11, 46, 44, 35, 22],
[26, 18, 4, 40, 40, 23],
[27, 23, 30, 49, 28, 12]])
In [15]: D = B[:,np.argsort(A, axis=0)]
In [16]: D
Out[16]:
array([[20, 13, 26, 24, 43, 15],
[ 7, 11, 47, 36, 36, 14],
[19, 43, 41, 14, 44, 32],
[11, 22, 46, 35, 27, 44],
[18, 23, 4, 40, 26, 40],
[23, 12, 30, 28, 27, 49]])