VOOZH about

URL: https://www.geeksforgeeks.org/python/how-to-round-elements-of-the-numpy-array-to-the-nearest-integer/

⇱ How to round elements of the NumPy array to the nearest integer? - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

How to round elements of the NumPy array to the nearest integer?

Last Updated : 15 Jul, 2025

Prerequisites: Python NumPy

In this article, let's discuss how to round elements of the NumPy array to the nearest integer. numpy.rint() function of Python that can convert the elements of an array to the nearest integer.

Syntax: numpy.rint(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'rint'>

Example 1:

Output:

👁 Image

Example 2:

Output:

👁 Image

Comment