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

Grissiom chaos.proton at gmail.com
Tue Dec 9 21:56:01 EST 2008


On Wed, Dec 10, 2008 at 10:36, Robert Kern <robert.kern at gmail.com> wrote:

> On Tue, Dec 9, 2008 at 20:24, Grissiom <chaos.proton at 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'm sorry for my poor English. I mean a function that could return a unit
vector which have the same direction with the original one. Thanks.

-- 
Cheers,
Grissiom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20081210/44786bee/attachment.html>


More information about the NumPy-Discussion mailing list