[Numpy-discussion] Elementary Array Switching

Robert Kern robert.kern@gmail....
Fri Jun 12 13:25:23 CDT 2009

On Fri, Jun 12, 2009 at 13:21, Ian Mallett<geometrian@gmail.com> wrote:
> 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.

What did you expect? What did you get? Show us the results.

Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco

More information about the Numpy-discussion mailing list