On Fri, May 30, 2014 at 4:48 PM, Bob Dowling <rjd4+nu...@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. > > For example, suppose I have an array of shape (100,200,300,3) and I > want to create a view of this where the vector coordinate is axis 0, not > axis 3. (So the view will have shape (3,100,200,300).) > > > Reading the help(numpy.ndarray) output I can't find anything better than > repeated calls to swapaxes(): > > >>> B = A.swapaxes(0,3).swapaxes(1,3).swapaxes(2,3) > > > Is there a "reorder_axes()" method that would let me write something > like this: > > >>> B = A.reorder_axes((3,0,1,2)) > > Apologies in advance if I've missed the obvious method in the docs.
http://docs.scipy.org/doc/numpy/reference/generated/numpy.ndarray.transpose.html -- Robert Kern _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion