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
🌐
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).
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.4 Manual
The floor of the scalar x is the largest integer i, such that i <= x. It is often denoted as \(\lfloor x \rfloor\). ... Input data. outndarray, None, or tuple of ndarray and None, optional · A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.1 Manual
The floor of the scalar x is the largest integer i, such that i <= x. It is often denoted as \(\lfloor x \rfloor\). ... Input data. outndarray, None, or tuple of ndarray and None, optional · A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.2 Manual
The floor of the scalar x is the largest integer i, such that i <= x. It is often denoted as \(\lfloor x \rfloor\). ... Input data. outndarray, None, or tuple of ndarray and None, optional · A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to.
🌐
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.
🌐
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 - The returned data type is a floating-point number (float). Use astype() to convert it to an integer (int). This also applies to np.trunc(), np.ceil(), etc. NumPy: Cast ndarray to a specific dtype with astype()
🌐
Medium
medium.com › @amit25173 › different-ways-to-convert-numpy-float-to-int-f47f3be42453
Different Ways to Convert NumPy Float to Int | by Amit Yadav | Medium
April 12, 2025 - The easiest and most common way to convert floats to integers in NumPy is by using .astype(int).
🌐
Programiz
programiz.com › python-programming › numpy › methods › floor
NumPy floor() (With Examples)
NumPy absolute() 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]) # round down each element in array1 to nearest smallest integer result = np.floor(array1) print(result) # Output: [1.
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 - The NumPy floor() function takes two main parameters and returns the floor value of each array element with a float data type. The floor value of the scalar x is the largest integer y, such that y<=x.
🌐
EDUCBA
educba.com › home › software development › software development tutorials › numpy tutorial › numpy floor()
NumPy floor() | Quick Guide to NumPy floor() in Python Language
March 20, 2023 - NumPy floor() is a mathematical function that is present in the tool used while coding in the Python language. It returns the floor value of the elements that are present in an array. So, for an array containing scalar values coma foreign element ‘x’ a value ‘i’ would be returned which would be the largest integer (such that the value of i <=x)
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
GitHub
github.com › numpy › numpy › issues › 4054
WISH: [option to] make np.floor(), np.ceil(), np.trunc() etc return arrays with dtype=int · Issue #4054 · numpy/numpy
October 5, 2013 - However, np.floor returns a float array so I need to cast the result to an integer type first.
Author   chatcannon
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › floor
Python Numpy floor() - Round Down Values | Vultr Docs
November 14, 2024 - In this article, you will learn how to utilize the floor() function effectively across various scenarios. Explore the function's application on single values, arrays, and in combination with other NumPy operations to master handling decimal data efficiently.
🌐
GitHub
github.com › numpy › numpy › issues › 9068
np.ceil and np.floor are inconsistent with math.ceil and math.floor · Issue #9068 · numpy/numpy
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
🌐
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 - Zero stays the same, because, well, there’s nothing to round down. This works for arrays with any size and shape. If you’ve got a bunch of numbers and need them all rounded down in one go, numpy.floor is your best friend. ... out: An optional parameter. If you provide an array here, the results will be stored directly in it, saving memory. ... One great thing about numpy.floor is that it works effortlessly with different data types. Whether your array contains floats, integers, or a mix of both, numpy.floor has you covered.
🌐
Educative
educative.io › answers › what-is-the-numpyfloor-function-in-numpy
What is the numpy.floor() function in NumPy?
At a given location where this condition is True, the resulting array will be set to the ufunc result. Otherwise, the resulting array will retain its original value. **kwargs (optional): This represents other keyword arguments. The numpy.floor() function returns an array containing the floor ...
🌐
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 - The range is the set of integers. We will try our function by passing single values, arrays, and complex numbers. First of all, We need to import the required module which is the Numpy module. ... In this step, We will implement our function as below. import numpy #Passing single value in our function a = numpy.floor(0.366) print(a) #output 0.0 #passing multiple values in the form of array import math input = numpy.array([-2.35, 0, 0.36, 1, 5.69, math.pi, 5/2, 5%3]) b = numpy.floor(input) print(b) #output [-3.
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.floor_divide.html
numpy.floor_divide — NumPy v2.1 Manual
Round a number to the nearest integer toward infinity. ... >>> import numpy as np >>> np.floor_divide(7,3) 2 >>> np.floor_divide([1., 2., 3., 4.], 2.5) array([ 0., 0., 1., 1.])
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.5.dev0 Manual
The floor of the scalar x is the largest integer i, such that i <= x. It is often denoted as \(\lfloor x \rfloor\). ... Input data. outndarray, None, or tuple of ndarray and None, optional · A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to.