[Numpy-discussion] Getting the only object in a zero dimensional array

Robert Kern robert.kern at gmail.com
Mon Apr 20 13:40:55 EDT 2009


On Mon, Apr 20, 2009 at 12:39, Fadhley Salim
<Fadhley.Salim at uk.calyon.com> wrote:
> I have a 0d array that looks like this:
>
> myarray = array( 0.1234 )
>
> This generates a TypeError:
> myarray[0]

myarray[()] or myarray.item()

-- 
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