[Numpy-discussion] Elementary Array Switching

Robert Kern robert.kern at gmail.com
Fri Jun 12 14:25:23 EDT 2009

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