Подтвердить что ты не робот

Matlab "переместить" в python

Я переводил программу из Matlab в Python.

В коде Matlab используется метод перестановки:

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.

Есть ли эквивалентный метод в Python/NumPy?

4b9b3361

Ответ 1

Это выполняется в transpose в numpy.ndarray. По умолчанию поведение отменяет порядок, но вы можете предоставить список своего собственного заказа.