[SciPy-user] TypeError: can't convert complex to float; use abs(z)

Robert Kern robert.kern@gmail....
Thu Apr 3 04:56:18 CDT 2008

On Thu, Apr 3, 2008 at 4:25 AM, lorenzo bolla <lbolla@gmail.com> wrote:
> your function gij returns a 2d array (a matrix) with just 1 element.
> you cannot assign to the element b[0,0], the value of the matrix c, but you
> can assign it the value of the _only_ element of c, i.e. c.item().
>  your last line become:
> b[0,0] = c.item()

Correct. However, it's still a weird error message that may be
indicative of incorrect code somewhere in numpy.

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 SciPy-user mailing list