[Numpy-discussion] Elementary Array Switching

Ian Mallett geometrian at gmail.com
Fri Jun 12 14:21:02 EDT 2009


I have a NumPy array.  The array is 3D, n x n x 3.  I'm trying to flip the
first element of the last dimension with the last.  I tried:
temp = myarray[:,:,0].copy()
myarray[:,:,0] = myarray[:,:,2].copy()
myarray[:,:,2] = temp
del temp
But it doesn't work as expected.

I'm definitely not very good at NumPy, so I get the feeling it's something
silly I'm doing.  What should that code look like?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20090612/96cfe3a9/attachment.html>

More information about the NumPy-Discussion mailing list