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
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.4 Manual
numpy.floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'floor'>#
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-floor-python
numpy.floor() in Python - GeeksforGeeks
April 8, 2025 - Python · import numpy as np a = [0.5, 1.5, 2.5, 3, 4.5, 10.1] res = np.floor(a) print("Floored:", res) Output · Floored: [ 0. 1. 2. 3. 4. 10.] Explanation: np.floor() function reduces every element of the array 'a' to its floor value. ...
🌐
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.
🌐
Medium
medium.com › @whyamit404 › numpy-floor-in-python-7e79aa697fb9
numpy.floor in Python. If you think you need to spend $2,000… | by whyamit404 | Medium
February 9, 2025 - Think of floor as stepping down a staircase and ceil as stepping up—it’s all about the direction. ... You might be wondering: Can I skip creating a NumPy array and just use it on a list? The short answer is no, but NumPy is smart enough to handle this for you behind the scenes. ... # A simple Python list my_list = [3.4, 2.8] # Apply numpy.floor print(np.floor(my_list)) # Output: [3.
🌐
Programiz
programiz.com › python-programming › numpy › methods › floor
NumPy floor() (With Examples)
The floor() function is used to round down each element in an array to the nearest smallest integer The floor() function rounds down each element in an array to the nearest smallest integer. Example import numpy as np array1 = np.array([1.9, 2.2, 3.1, 4.3]) # round down each element in array1 ...
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python numpy floor() function examples
Python NumPy floor() Function Examples - Spark By {Examples}
March 27, 2024 - In NumPy, the numpy.floor() function is used to round elements of an array to the nearest integer, towards negative infinity. It returns the floor of input, element-wise.
Find elsewhere
🌐
Note.nkmk.me
note.nkmk.me › home › python › numpy
Round up/down array elements (np.floor, np.trunc, np.ceil)
January 15, 2024 - The NumPy version used in this article is as follows. Note that functionality may vary between versions. ... Use np.floor() to round toward negative infinity.
🌐
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.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.1 Manual
>>> import numpy as np >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) >>> np.floor(a) array([-2., -2., -1., 0., 1., 1., 2.])
🌐
Educative
educative.io › answers › what-is-the-numpyfloor-function-in-numpy
What is the numpy.floor() function in NumPy?
The numpy.floor() function in NumPy is used to return the floor values of each element in an input array x such that for each of the elements of x, the floor values are less than or equal to it.
🌐
Javatpoint
javatpoint.com › numpy-floor
numpy.floor() in Python - Javatpoint
numpy.floor() in Python with NumPy Introduction, Environment Setup, ndarray, Data Types, Array Creation, Attributes, Existing Data, Indexing and Slicing, Advanced Indexing, Broadcasting, Array Manipulation, Matrix Library, Matplotlib etc.
🌐
LabEx
labex.io › tutorials › numpy-floor-function-86441
Numpy Floor Function: Mastering the Fundamentals | LabEx
The numpy.floor() function is a mathematical function in the Numpy library that takes an array as an input and returns an array with the largest integer less than or equal to each element of the input array.
🌐
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.,...
🌐
Stack Overflow
stackoverflow.com › questions › 71845692 › numpy-floor-values-of-array-to-different-array-of-values-similar-to-np-floor
python - numpy: floor values of array to different array of values (similar to np.floor) - Stack Overflow
I could do this in a loop, but I'm sure there is a numpy way of doing this. Any tips much appreciated. ... Please include how you do this in a loop. ... If b is sorted and contains a valid floor value for every element in a: np.array(b)[np.greater_equal.outer(a,b).sum(2) - 1], IIUC
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.floor_divide.html
numpy.floor_divide — NumPy v2.0 Manual
numpy.floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'floor_divide'># Return the largest integer smaller or equal to the division of the inputs. It is equivalent to the Python // operator and pairs with the Python ...
🌐
AskPython
askpython.com › home › numpy floor – return the floor of the input, element-wise
Numpy floor - Return the floor of the input, element-wise - AskPython
November 19, 2022 - Numpy floor is a function that returns the floor of the input, element-wise. This function is useful for rounding down to the nearest integer.
🌐
GitHub
github.com › numpy › numpy › issues › 9068
np.ceil and np.floor are inconsistent with math.ceil ...
May 7, 2017 - In Python 3, floor and ceil changed to return integers, rather than floats: >>> math.floor(1.5), math.ceil(1.5) (1, 2) >>> np.floor(1.5), np.ceil(1.5) (1.0, 2.0) # also the output for the first case on 2.7 Should we update these function...
Author   eric-wieser
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.floor_divide.html
numpy.floor_divide — NumPy v2.4 Manual
numpy.floor_divide(x1, x2, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'floor_divide'># Return the largest integer smaller or equal to the division of the inputs. It is equivalent to the Python // operator and pairs with the Python ...