numpy.rint

numpy.rint(x[, out])

Round elements of the array to the nearest integer.

Parameters:

x : array_like

Input array.

Returns:

out : ndarray

Output array is same shape and type as x.

Examples

>>> a = [-4.1, -3.6, -2.5, 0.1, 2.5, 3.1, 3.9]
>>> np.rint(a)
array([-4., -4., -2.,  0.,  2.,  3.,  4.])

Previous topic

numpy.round

Next topic

numpy.fix

This Page

Quick search