[Numpy-discussion] How to unitize a array in numpy?

Robert Kern robert.kern@gmail....
Tue Dec 9 20:36:53 CST 2008


On Tue, Dec 9, 2008 at 20:24, Grissiom <chaos.proton@gmail.com> wrote:
> Hi all,
>
> Nice to neet you all. I am a newbie in numpy. Is there any function that
> could unitize a array?

If you mean like the Mathematica function Unitize[] defined here:

  http://reference.wolfram.com/mathematica/ref/Unitize.html

Then .astype(bool) is probably sufficient.

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