6 Oct
2007
6 Oct
'07
12:51 a.m.
On Fri, 05 Oct 2007, dmitrey wrote:
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])
Use ``astype``. Cheers, Alan Isaac
import numpy as N x = N.array([1,2,3],dtype='float') x array([ 1., 2., 3.]) x.astype('int') array([1, 2, 3])