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 › 2.2 › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.2 Manual
numpy.floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'floor'>#
🌐
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'>#
🌐
NumPy
numpy.org › doc › 2.1 › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.1 Manual
numpy.floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'floor'>#
🌐
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 - -10.1 -10.9]] print(np.floor(a)) # [[ 10. 10. 10.] # [-10. -11. -11.]] print(np.floor(a).dtype) # float64 · source: numpy_floor_trunc_ceil.py · The returned data type is a floating-point number (float).
🌐
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
November 14, 2013 - WISH: [option to] make np.floor(), np.ceil(), np.trunc() etc return arrays with dtype=int#4054 · Copy link · chatcannon · opened · on Nov 14, 2013 · Issue body actions · I'm trying to plot two quantities against each other but they are sampled at different intervals.
Author   chatcannon
🌐
GitHub
github.com › numpy › numpy › issues › 26988
BUG: `np.ceil`/`np.floor` fails when specified `dtype` is int · Issue #26988 · numpy/numpy
June 8, 2024 - When using np.ceil or np.floor, you cannot specify an integer return dtype.
Author   mcrumiller
🌐
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 - add f->i loops to the ufunc, so that np.floor(1.5, dtype=int) is possible · on python 3, start FutureWarning on np.floor(1.5) with no dtype · on python 3, switch the default dtype to int · Reactions are currently unavailable · No one assigned · component: numpy._core ·
Author   eric-wieser
🌐
Nabble
numpy-discussion.10968.n7.nabble.com › floor-with-dtype-td44734.html
Numpy-discussion - floor with dtype
September 25, 2017 - Numpy-discussion · floor with dtype · Locked 5 messages · Renato Fabbri-3 · Reply | Threaded · Open this post in threaded view · Thomas Jollans
Find elsewhere
🌐
Vultr Docs
docs.vultr.com › python › third-party › numpy › floor
Python Numpy floor() - Round Down Values | Vultr Docs
November 14, 2024 - The np.floor() function in NumPy is a powerful tool for number manipulation, allowing for efficient rounding down of various data types. It simplifies precise control over numeric data, particularly useful in fields like data science and financial ...
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python numpy floor() function examples
Python NumPy floor() Function Examples - Spark By {Examples}
March 27, 2024 - This function returns an array that contains floor values of input array elements. The np.floor() is a mathematical NumPy library function that returns the floor value of the array element with a float data type.
🌐
GeeksforGeeks
geeksforgeeks.org › python › numpy-floor-python
numpy.floor() in Python - GeeksforGeeks
April 8, 2025 - Floored: [ 0. 1. 2. 3. 4. 10.] Explanation: np.floor() function reduces every element of the array 'a' to its floor value.
🌐
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(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'floor'>
Address   Unit no. 202, Jay Antariksh Bldg, Makwana Road, Marol, Andheri (East),, 400059, Mumbai
🌐
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]])
🌐
NumPy
numpy.org › doc › 2.3 › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.3 Manual
numpy.floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'floor'>#
🌐
NumPy
numpy.org › doc › 1.16 › reference › generated › numpy.floor.html
numpy.floor — NumPy v1.16 Manual
February 18, 2020 - numpy.floor(x, /, out=None, *, ... dtype=None, subok=True[, signature, extobj]) = <ufunc 'floor'>¶ · Return the floor of the input, element-wise. The floor of the scalar x is the largest integer i, such that i <= x. It is often denoted as . ... Some spreadsheet programs calculate the “floor-towards-zero”, in other words floor(-2.5) == -2. NumPy instead uses the definition of floor where floor(-2.5) == -3. ... >>> a = np.array([-1.7, ...
🌐
NumPy
numpy.org › devdocs › reference › generated › numpy.floor.html
numpy.floor — NumPy v2.5.dev0 Manual
numpy.floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature]) = <ufunc 'floor'>#
🌐
Linux Hint
linuxhint.com › numpy-np-floor
NumPy np.floor()
May 27, 2022 - Linux Hint LLC, [email protected] 1210 Kelly Park Circle, Morgan Hill, CA 95037 Privacy Policy and Terms of Use
🌐
NumPy
numpy.org › doc › 1.23 › reference › generated › numpy.floor.html
numpy.floor — NumPy v1.23 Manual
numpy.floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) = <ufunc 'floor'>#