Python Practice › NumPy Programs › Program 98
Ceiling of each element
Write a NumPy program to round elements up with ceil.
Input
[4.8757, 2.4578]
Output
[5. 3.]
Approach
np.ceil.
Solution
import numpy as npprint(np.ceil([4.8757, 2.4578]))Output
[5. 3.]
Learn the concept
New to this topic? Read the lesson, then come back.