[MATRIX-SIG] float -> integer with array?
David Ascher
da@maigret.cog.brown.edu
Wed, 10 Sep 1997 11:10:37 -0400 (EDT)
> Is there a way to convert a float array to
> an integer ?
> (In my case, I just have zeros behind decimal point).
>>> x = arange(5, typecode='f')
>>> print x
[ 0. 1. 2. 3. 4.]
>>> y = a.astype('i')
>>> print y
[0 1 2 3 4]
>>> print y.typecode()
i
_______________
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
_______________