[Numpy-discussion] Elementary Array Switching

Ian Mallett geometrian@gmail....
Fri Jun 12 13:21:02 CDT 2009


Hi,

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?

Thanks,
Ian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20090612/96cfe3a9/attachment.html 


More information about the Numpy-discussion mailing list