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

Robert Kern robert.kern@gmail....
Mon Apr 20 12:40:55 CDT 2009


On Mon, Apr 20, 2009 at 12:39, Fadhley Salim
<Fadhley.Salim@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