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 - DSA Python ยท Data Science ยท NumPy ยท Pandas ยท Practice ยท Django ยท Flask ยท Last Updated : 8 Apr, 2025 ยท The numpy.floor() function returns the largest integer less than or equal to each element in the input array.
Discussions

python - Numpy floor float values to int - Stack Overflow
As alternative to changing type after floor division, you can provide an output array of the desired data type to np.floor (and to any other numpy ufunc). More on stackoverflow.com
๐ŸŒ stackoverflow.com
python - floor and ceil with number of decimals - Stack Overflow
Neither Python built-in nor numpy's version of ceil/floor support precision. More on stackoverflow.com
๐ŸŒ stackoverflow.com
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 More on stackoverflow.com
๐ŸŒ stackoverflow.com
np.ceil and np.floor are inconsistent with math.ceil and math.floor
There was an error while loading. Please reload this page ยท In Python 3, floor and ceil changed to return integers, rather than floats: More on github.com
๐ŸŒ github.com
10
May 7, 2017
๐ŸŒ
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 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]])
Find elsewhere
๐ŸŒ
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.
๐ŸŒ
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.
๐ŸŒ
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.
๐ŸŒ
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 ...