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

2009-04-20 Thread Robert Kern
On Mon, Apr 20, 2009 at 12:39, Fadhley Salim 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 tha

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

2009-04-20 Thread Fadhley Salim
I have a 0d array that looks like this: myarray = array( 0.1234 ) This generates a TypeError: myarray[0] I can get it's number using a hack like this... but it looks kind of wrong: myval = myarray + 0.0 There must be a better way to do it, right? All I want is the correct way to return the val