[Numpy-discussion] Truth value of an array

Robert Kern robert.kern@gmail....
Sat Apr 19 01:44:39 CDT 2008


On Sat, Apr 19, 2008 at 1:32 AM, Joe Harrington <jh@physics.ucf.edu> wrote:
>  What wasn't obvious was how to cast an array to bool.

Just like any other type:

  x.astype(bool)

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