Facebook Page Twitter Page LinkedIn Page
× NumPy Tutorial NumPy Resources

The NumPy floor() function is used to return the floor value of the input data. The floor of the scalar x is the largest integer i, such that i <= x.


numpy.floor(a, out=None)


a Required. Specify array (array_like) containing elements, of which the floor value is calculated.
out Optional. Specify a location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.

Return Value

Returns the floor value of each element of a.


In the below example, numpy floor() function is used to calculate the floor value of each element present in array Arr.

import numpy as np

Arr = np.array([0.65, 6.56, 52.67, 167.23])
print("Original Array:")

print("\nFloor value array:")

The output of the above code will be:

Original Array:
[   0.65    6.56   52.67  167.23]

Floor value array:
[   0.    6.   52.  167.]

❮ NumPy - Functions