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

Sebastian Haase haase at msg.ucsf.edu
Tue Mar 6 23:49:00 EST 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