[Numpy-discussion] how to round to int (I mean 5.2 to 5 not 5.0)

Sebastian Haase haase@msg.ucsf....
Tue Mar 6 22:49:00 CST 2007


Hi,
why does
numpy.round(a)
return a float ?

I need something that I can use as indices for another array. Do I
have to (implicitly) create a temporary array  and use:
N.round(a).astype(N.int)  ?

Or is there a simple, clean and easy way to just round
[1.1 4.8]
into
[1 5]

Thanks,
Sebastian


More information about the Numpy-discussion mailing list