[Numpy-discussion] howto convert float array to array of integers

lorenzo bolla lbolla at gmail.com
Fri Oct 5 08:21:33 EDT 2007


what about astype?

a.astype(t) -> Copy of array cast to type t.

    Cast array m to type t.  t can be either a string representing a
typecode,
    or a python type object of type int, float, or complex.

L.


On 10/5/07, dmitrey <dmitrey.kroshko at scipy.org> wrote:
>
> hi all,
> I have an array like
> array([ 1.,  0.,  2.,  -10.])
> what is most efficient (i.e. fastest) way to convert the one to array of
> integers?
> array([ 1,  0,  2,  -10])
>
> Thx in advance, D.
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at scipy.org
> http://projects.scipy.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20071005/580c285a/attachment.html>


More information about the NumPy-Discussion mailing list