[Numpy-discussion] Reordering indices

Jaime Fernández del Río jaime.frio at gmail.com
Fri May 30 12:45:33 EDT 2014


On Fri, May 30, 2014 at 8:48 AM, Bob Dowling <rjd4+numpy at cam.ac.uk> wrote:

> Is there a clean way to create a view on an existing ND-array with its
> axes in a different order.
>
>
There's an epidemic of axes reordering, the exact same thing was asked
yesterday in StackOverflow:

http://stackoverflow.com/questions/23943379/swapping-the-dimensions-of-a-numpy-array/23944468#23944468

Aside from the general solution provided by Robert, for your use case,
where you just want to move a single axis to a different position, you may
want to use `np.rollaxis`:

http://docs.scipy.org/doc/numpy/reference/generated/numpy.rollaxis.html

Jaime

-- 
(\__/)
( O.o)
( > <) Este es Conejo. Copia a Conejo en tu firma y ayúdale en sus planes
de dominación mundial.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20140530/83de4c62/attachment.html>


More information about the NumPy-Discussion mailing list