Program to round off the elements in an array using ceil function

In this python numpy program, we will round off the elements in an array using ceil function.

Steps to solve the program
  1. Import the numpy library as np.
  2. Create an array using np.array().
  3. Round off the elements in an array using np.ceil().
  4. It will round up a decimal number to the next value i.e 12.5 will be 13.
  5. Print the output.

				
					import numpy as np
arr = np.array([12.202, 90.23120, 123.88, 23.202])  

print(np.ceil(arr)
				
			

Output :

				
					[ 13.  91. 124.  24.]
				
			

round off the elements in an array using the floor function.

convert a tuple into an array.

Leave a Comment