matlab's "permute" in python
I'm translating a program from matlab to Python.
The matlab code uses the method permute:
B = PERMUTE(A,ORDER) rearranges the dimensions of A so that they % are in the order specified by the vector ORDER. The array produced % has the same values as A but the order of the subscripts needed to % access any particular element are rearranged as specified by ORDER. % For an N-D array A, numel(ORDER)>=ndims(A). All the elements of % ORDER must be unique.
Is there an equivalent method in Python/NumPy ?
This is rolled into the transpose function in numpy.ndarray. The default behavior reverses the order, but you can supply a list of your own order.