I am edit answer with @DanielF explanation: "floor doesn't convert to integer, it just gives integer-valued floats, so you still need an astype to change to int" Check this code to understand the solution:

import numpy as np
arr = np.random.rand(1, 10) * 10
print(arr)
arr = np.floor(arr).astype(int)
print(arr)
OUTPUT:
[[2.76753828 8.84095843 2.5537759  5.65017407 7.77493733 6.47403036
  7.72582766 5.03525625 9.75819442 9.10578944]]
[[2 8 2 5 7 6 7 5 9 9]]
Answer from Jocker on Stack Overflow
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › floor
Python Numpy floor() - Round Down Values | Vultr Docs
November 14, 2024 - The code outputs 3.0. numpy.floor() rounds down 3.7 to the nearest whole number, which is 3.
🌐
Real Python
realpython.com › python-rounding
How to Round Numbers in Python – Real Python
December 7, 2024 - To round every value down to the nearest integer, use np.floor(): ... You might have noticed that a lot of the rounding strategies that you studied earlier are missing here. For the vast majority of situations, the .round() method is all you need.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.round.html
numpy.round — NumPy v2.1 Manual
>>> import numpy as np >>> np.round([0.37, 1.64]) array([0., 2.]) >>> np.round([0.37, 1.64], decimals=1) array([0.4, 1.6]) >>> np.round([.5, 1.5, 2.5, 3.5, 4.5]) # rounds to nearest even value array([0., 2., 2., 4., 4.]) >>> np.round([1,2,3,11], decimals=1) # ndarray of ints is returned array([ 1, 2, 3, 11]) >>> np.round([1,2,3,11], decimals=-1) array([ 0, 0, 0, 10])
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-floor-python
numpy.floor() in Python - GeeksforGeeks
April 8, 2025 - The numpy.floor() function returns the largest integer less than or equal to each element in the input array. It effectively rounds numbers down to the nearest whole number. Let's understand with an example: ... Floored: [ 0. 1. 2. 3. 4. 10.]
🌐
Codecademy
codecademy.com › docs › python:numpy › math methods › .floor()
Python:NumPy | Math Methods | .floor() | Codecademy
May 14, 2025 - np.floor() rounds down to the nearest smallest integer (toward negative infinity).
Find elsewhere
🌐
datagy
datagy.io › home › python posts › round number to the nearest multiple in python (2, 5, 10, etc.)
Round Number to the Nearest Multiple in Python (2, 5, 10, etc.) • datagy
April 13, 2023 - We can customize our function to take a third parameter to indicate that we want to round down, up, or to the nearest multiple. # Developing a function to round to a multiple from math import ceil, floor def round_to_multiple(number, multiple, direction='nearest'): if direction == 'nearest': return multiple * round(number / multiple) elif direction == 'up': return multiple * ceil(number / multiple) elif direction == 'down': return multiple * floor(number / multiple) else: return multiple * round(number / multiple) # Rounding 23 to a multiple of 5 print(round_to_multiple(23, 5, 'nearest2')) print(round_to_multiple(23, 5, 'up')) print(round_to_multiple(23, 5, 'down')) # Returns: # 25 # 25 # 20
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python numpy round() array function
Python NumPy round() Array Function - Spark By {Examples}
March 27, 2024 - # Get the rounding values of # ... rounded the values of an array to the nearest multiple of 100, you can use the numpy.round() function....
🌐
Python Forum
python-forum.io › thread-40099.html
Get numpy ceil and floor value for nearest two decimals
June 2, 2023 - I'm trying to get ceiling value of the input for two decimals. import numpy as np a = np.array([-1.784, -1.5888, -0.24444, 0.25555, 1.5, 1.75, 2.0]) np.around(a,2)array([-1.78, -1.59, -0.24, 0.26, 1.5 , 1.75, 2. ]) np.ceil(a)array([-1., -1.,...
🌐
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 - Note that functionality may vary between versions. ... Use np.floor() to round toward negative infinity. ... a = np.array([[10.0, 10.1, 10.9], [-10.0, -10.1, -10.9]]) print(a) # [[ 10.
🌐
Programiz
programiz.com › python-programming › numpy › methods › floor
NumPy floor() (With Examples)
# round down each element in array1 to nearest smallest integer result = np.floor(array1) print(result) # Output: [1. 2. 3. 4.] ... The floor() function returns an array that contains the rounded-down values of each element in the input array. import numpy as np # create a 2-D array array1 = np.array([[1.2, 2.7, 3.5], [4.9, 5.1, 6.8]])
🌐
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 - It helps when you don’t need exact values but just want to approximate to the nearest 10s, 100s, or 1000s. ✅ What’s the Difference Between round(), rint(), and astype(int)? You might be thinking, “They all round numbers, so what’s the big deal?” Well, each of them plays by slightly different rules. Here’s a quick comparison to clear things up: ... import numpy as np arr = np.array([1.7, 2.5, 3.8, 4.5]) print(np.round(arr)) # [2.
🌐
TutorialKart
tutorialkart.com › python › python-round › python-round-to-nearest-10
Python - Round Number to Nearest 10
November 30, 2020 - For example, if the number is 3652, then its nearest number to 10 is 3650.
🌐
YouTube
youtube.com › watch
NumPy floor() Function - Round Down to Nearest Integer | Python Tutorial - YouTube
🔢 Master the np.floor() function in NumPy! Learn how to round numbers down to the nearest integer with practical examples and clear explanations.📚 What You...
Published   October 29, 2025
🌐
Bobby Hadz
bobbyhadz.com › blog › python-round-number-to-nearest-100
Round a number to the nearest 5, 10, 100, 1000 in Python | bobbyhadz
April 9, 2024 - Multiply the result by 10 to get the number rounded up to the nearest 10. Use the math.floor() method to round down to the nearest 10.