floor() - ( NumPy Functions )
Heading h2
Syntax
numpy.floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj])
Example
import numpy as np
x = np.array([1.4, 2.3, 3.8, 4.5, 5.7])
print(np.floor(x))
Output
[1, 2, 3, 4, 5]
Explanation
The floor()
function in NumPy returns the largest integer less than or equal to the input array. It is a rounding function that rounds off to the nearest integer that is less than or equal to the given value.
Use
The floor()
function can be used for a wide range of applications such as data normalization, data analysis, and mathematical modeling.
Important Points
- The
floor()
function rounds down the elements of an array to the nearest integer that is less than or equal to the given value. - In NumPy, the
floor()
function is availabe in thenumpy
module. - The
floor()
function can be applied to 1D, 2D, and multi-dimensional arrays.
Summary
In conclusion, the floor()
function in NumPy is a very useful mathematical function that rounds off values to the nearest integer that is less than or equal to the given value. It can be used in various applications such as data normalization, data analysis, and mathematical modeling. The floor()
function is very efficient and is widely used in scientific computing, data analysis, and numerical computation.