numpy.ceil() in Python Last Updated : 08 Mar, 2024 Comments Improve Suggest changes Like Article Like Report The numpy.ceil() is a mathematical function that returns the ceil of the elements of array. The ceil of the scalar x is the smallest integer i, such that i >= x Syntax : numpy.ceil(x[, out]) = ufunc ‘ceil’) Parameters : a : [array_like] Input array Return : The ceil of each element with float data-type. Code #1 : Working Python3 # Python program explaining # ceil() function import numpy as np in_array = [.5, 1.5, 2.5, 3.5, 4.5, 10.1] print ("Input array : \n", in_array) ceiloff_values = np.ceil(in_array) print ("\nRounded values : \n", ceiloff_values) in_array = [.53, 1.54, .71] print ("\nInput array : \n", in_array) ceiloff_values = np.ceil(in_array) print ("\nRounded values : \n", ceiloff_values) in_array = [.5538, 1.33354, .71445] print ("\nInput array : \n", in_array) ceiloff_values = np.ceil(in_array) print ("\nRounded values : \n", ceiloff_values) Output : Input array : [0.5, 1.5, 2.5, 3.5, 4.5, 10.1] Rounded values : [ 1. 2. 3. 4. 5. 11.] Input array : [0.53, 1.54, 0.71] Rounded values : [ 1. 2. 1.] Input array : [0.5538, 1.33354, 0.71445] Rounded values : [ 1. 2. 1.] Code #2 : Working Python3 # Python program explaining # ceil() function import numpy as np in_array = [1.67, 4.5, 7, 9, 12] print ("Input array : \n", in_array) ceiloff_values = np.ceil(in_array) print ("\nRounded values : \n", ceiloff_values) in_array = [133.000, 344.54, 437.56, 44.9, 1.2] print ("\nInput array : \n", in_array) ceiloff_values = np.ceil(in_array) print ("\nRounded values upto 2: \n", ceiloff_values) Output : Input array : [1.67, 4.5, 7, 9, 12] Rounded values : [ 2. 5. 7. 9. 12.] Input array : [133.0, 344.54, 437.56, 44.9, 1.2] Rounded values upto 2: [ 133. 345. 438. 45. 2.] Comment More infoAdvertise with us Next Article numpy.ceil() in Python mohit gupta_omg :) Follow Improve Article Tags : Python Python-numpy Python numpy-Mathematical Function Practice Tags : python Similar Reads Python | math.ceil() function In Python, math module contains a number of mathematical operations, which can be performed with ease using the module. math.ceil() function returns the smallest integral value greater than the number. If number is already integer, same number is returned. Syntax: math.ceil(x) Parameter: x: This is 1 min read numpy.fromiter() function â Python NumPy's fromiter() function is a handy tool for creating a NumPy array from an iterable object. This iterable can be any Python object that provides elements one at a time. The function is especially useful when you need to convert data from a custom data source, like a file or generator, into a Num 2 min read bool() in Python In Python, bool() is a built-in function that is used to convert a value to a Boolean (i.e., True or False). The Boolean data type represents truth values and is a fundamental concept in programming, often used in conditional statements, loops and logical operations.bool() function evaluates the tru 3 min read Matplotlib.pyplot.clf() in Python Matplotlib is a library in Python and it is numerical - mathematical extension for NumPy library. Pyplot is a state-based interface to a Matplotlib module which provides a MATLAB-like interface. There are various plots which can be used in Pyplot are Line Plot, Contour, Histogram, Scatter, 3D Plot, 1 min read float() in Python Python float() function is used to return a floating-point number from a number or a string representation of a numeric value. Example: Here is a simple example of the Python float() function which takes an integer as the parameter and returns its float value. Python3 # convert integer value to floa 3 min read Python len() Function The len() function in Python is used to get the number of items in an object. It is most commonly used with strings, lists, tuples, dictionaries and other iterable or container types. It returns an integer value representing the length or the number of elements. Example:Pythons = "GeeksforGeeks" # G 2 min read NumPy Tutorial - Python Library NumPy (short for Numerical Python ) is one of the most fundamental libraries in Python for scientific computing. It provides support for large, multi-dimensional arrays and matrices along with a collection of mathematical functions to operate on arrays.At its core it introduces the ndarray (n-dimens 3 min read Python | Decimal is_nan() method Decimal#is_nan() : is_nan() is a Decimal class method which checks whether the Decimal value is NaN value. Syntax: Decimal.is_nan() Parameter: Decimal values Return: true - if the Decimal value is NaN value; otherwise false Code #1 : Example for is_nan() method Python3 # Python Program explaining # 2 min read Python - PyTorch ceil() method PyTorch torch.ceil() method returns a new tensor having the ceil value of the elements of input, Which is the smallest integer larger than or equal to each element. Syntax: torch.ceil(inp, out=None) Arguments inp: This is input tensor. out: The output tensor. Return: It returns a Tensor. Let's see t 1 min read Python | Decimal is_zero() method Decimal#is_zero() : is_zero() is a Decimal class method which checks whether the Decimal value is zero value. Syntax: Decimal.is_zero() Parameter: Decimal values Return: true - if the Decimal value is zero value; otherwise false Code #1 : Example for is_zero() method Python3 # Python Program explain 2 min read Like