Numpy floor()

This function returns the floor value of the input array elements. The floor of a number x is i if i is the largest integer such that, i<=x.

Syntax

snippet
numpy.floor(array)

Parameters

  1. array: Array elements whose floor values are to be calculated.

Return

An array containing the floor values is returned.

Example

snippet
import numpy as np

arr = [0.23, 0.09, 1.2, 1.24, 9.99]

print("Input array:",arr)

r_arr = np.floor(arr)

print("Output array:",r_arr)

arr2 = [145.23, 0.12, 12.34, 123]

r_arr2=np.floor(arr2)

print("Input array:",arr2)

print("Output array:",r_arr2)

Output:

Output
Input array: [0.23, 0.09, 1.2, 1.24, 9.99] Output array: [0. 0. 1. 1. 9.] Input array: [145.23, 0.12, 12.34, 123] Output array: [145. 0. 12. 123.]
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +