Numpy provides two identical methods to do this. Either use

np.round(data, 2)

or

np.around(data, 2)

as they are equivalent.

See the documentation for more information.


Examples:

>>> import numpy as np
>>> a = np.array([0.015, 0.235, 0.112])
>>> np.round(a, 2)
array([0.02, 0.24, 0.11])
>>> np.around(a, 2)
array([0.02, 0.24, 0.11])
>>> np.round(a, 1)
array([0. , 0.2, 0.1])
Answer from Joe Iddon on Stack Overflow
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: Round up/down array elements (np.floor, np.trunc, np.ceil) | note.nkmk.me
January 15, 2024 - You can use np.floor(), np.trunc(), and np.ceil() to round up and down the elements in a NumPy array (ndarray). Considering both positive and negative values, there are four main types of rounding: to ...
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › floor
Python Numpy floor() - Round Down Values | Vultr Docs
November 14, 2024 - The floor() function in NumPy is a mathematical tool designed to round down numeric values to the nearest whole number.
🌐
Programiz
programiz.com › python-programming › numpy › methods › floor
NumPy floor() (With Examples)
Become a certified Python programmer. Try Programiz PRO! ... The floor() function rounds down each element in an array to the nearest smallest integer. import numpy as np array1 = np.array([1.9, 2.2, 3.1, 4.3])
🌐
Codecademy
codecademy.com › docs › python:numpy › math methods › .floor()
Python:NumPy | Math Methods | .floor() | Codecademy
May 14, 2025 - In the NumPy library, the .floor() method rounds down a number or an array of numbers to the nearest integer that is less than or equal to the given value. It returns an array, with the elements separated by commas.
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
NumPy: Round array elements (np.round, np.around, np.rint) | note.nkmk.me
January 15, 2024 - After adjusting the number to the desired decimal place, 0.5 is added. Then, np.floor() is applied to truncate the decimal places, effectively rounding down towards negative infinity. Finally, the number is readjusted to its original decimal place.
Find elsewhere
🌐
Medium
medium.com › @heyamit10 › understanding-numpy-round-up-ceil-vs-round-vs-floor-f155922395b8
Understanding NumPy Round Up (ceil vs round vs floor) | by Hey Amit | Medium
April 12, 2025 - np.round(): Rounds to the nearest integer (up or down based on standard rounding rules). You might be wondering: “Why does this matter?” Well, in practical scenarios — like calculating prices, dealing with coordinates, or ensuring buffer limits — you often need to force numbers up instead of relying on regular rounding. Let’s see how each of these functions works in action: import numpy as np arr = np.array([1.2, 2.5, 3.8, -4.3, -5.9]) # Rounding up (ceil) rounded_up = np.ceil(arr) # Regular rounding rounded_normal = np.round(arr) # Rounding down (floor) rounded_down = np.floor(arr) print("Original:", arr) print("Ceil (Round Up):", rounded_up) # [ 2.
🌐
Real Python
realpython.com › python-rounding
How to Round Numbers in Python – Real Python
December 7, 2024 - The way in which computers store floating-point numbers in memory naturally introduces a subtle rounding error, but you learned how to work around this with the decimal module in Python’s standard library. You can round NumPy arrays and pandas Series and DataFrame objects. There are best practices for rounding with real-world data. Get Your Code: Click here to download the free sample code you’ll use to learn about rounding numbers in Python.
🌐
Medium
medium.com › @heyamit10 › how-to-round-numbers-to-integers-in-numpy-c43b43970c4c
How to Round Numbers to Integers in NumPy? | by Hey Amit | Medium
March 6, 2025 - Well, imagine you’re dealing with financial data, scientific measurements, or any situation where precision matters. Instead of rounding 1.746 to 2, maybe you just want to round it to one decimal place, like 1.7. ... import numpy as np arr = np.array([1.746, 2.312, 3.876, 4.543]) rounded_arr = np.round(arr, decimals=1) print(rounded_arr)
🌐
GeeksforGeeks
geeksforgeeks.org › numpy › numpy-round_-python
numpy.round_() in Python - GeeksforGeeks
December 6, 2024 - Input array: [0.5, 1.5, 2.5, 3.5, 4.5, 10.1] Rounded values: [ 0. 2. 2. 4. 4. 10.] In this example, numpy.round_() rounds each element of the array to the nearest integer.
🌐
Python Guides
pythonguides.com › python-numpy-round
Np.round() Function In Python
May 19, 2025 - Learn how to use NumPy's np.round() function to round decimal values in Python arrays with precision and control. Perfect for data science and numerical computations.
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.ndarray.round.html
numpy.ndarray.round — NumPy v2.4 Manual
Return a with each element rounded to the given number of decimals · Refer to numpy.around for full documentation