numpy.less() in Python Last Updated : 08 Mar, 2024 Comments Improve Suggest changes Like Article Like Report The numpy.less() : checks whether x1 is lesser than x2 or not. Syntax : numpy.less(x1, x2[, out]) Parameters : x1, x2 : [array_like]Input arrays. If x1.shape != x2.shape, they must be broadcastable to a common shape out : [ndarray, boolean]Array of bools, or a single bool if x1 and x2 are scalars. Return : Boolean array indicating results, whether x1 is lesser than x2 or not. Code 1 : Python # Python Program illustrating # numpy.less() method import numpy as geek a = geek.less([8., 2.], [5., 3.]) print("Not equal : \n", a, "\n") b = geek.less([2, 2], [[1, 3],[1, 4]]) print("Not equal : \n", b, "\n") a = geek.array([4,2]) b = geek.array([6,2]) print("Is a lesser than b : ", a < b) Output : Not equal : [False True] Not equal : [[False True] [False True]] Is a lesser than b : [ True False]] Code 2 : Python # Python Program illustrating # numpy.less() method import numpy as geek # Here we will compare Complex values with int a = geek.array([1j,2]) b = geek.array([1,2]) # indicating 1j is lesser than 1 print("Comparing complex with int : ", a < b) # indicating 1j is lesser than 1 d = geek.less(a, b) print("\n Comparing complex with int .less() : ", d) Output : Comparing complex with int : [ True False] Comparing complex with int .less() : [ True False] Code 3 : Python # Python Program illustrating # numpy.less() method import numpy as geek # Here we will compare Float with int values a = geek.array([1.1, 1]) b = geek.array([1, 2]) # indicating 1.1 is greater than 1 print("Comparing float with int : ", a < b) # indicating 1.1 is greater than 1 d = geek.less(a, b) print("\n Comparing float with int using .less() : ", d) Output : Comparing float with int : [False True] Comparing float with int using .less() : [False True] Comment More infoAdvertise with us Next Article numpy.less() in Python M Mohit Gupta_OMG Improve Article Tags : Python Python-numpy Python numpy-Logic Functions Practice Tags : python Similar Reads numpy.less_equal() in Python The numpy.less_equal() function checks whether x1 is <= x2 or not. Syntax : numpy.less_equal(x1, x2[, out]) Parameters : x1, x2 : [array_like]Input arrays. If x1.shape != x2.shape, they must be broadcastable to a common shape out : [ndarray, boolean]Array of bools, or a single bool if x1 and x2 a 2 min read numpy.index() in Python numpy.core.defchararray.index(arr, substring, start=0, end=None): Finds the lowest index of the sub-string in the specified range But if substring is not found, it raises ValueError. Parameters: arr : array-like or string to be searched. substring : substring to search for. start, end : [int, option 1 min read numpy.nansum() in Python numpy.nansum()function is used when we want to compute the sum of array elements over a given axis treating Not a Numbers (NaNs) as zero. Syntax : numpy.nansum(arr, axis=None, dtype=None, out=None, keepdims='no value') Parameters : arr : [array_like] Array containing numbers whose sum is desired. If 3 min read numpy.find() in Python numpy.core.defchararray.find(arr, substring, start=0, end=None): Finds the lowest index of the sub-string in the specified range. Parameters: arr : array-like or string to be searched. substring : substring to search for. start, end : [int, optional] Range to search in. Returns : An integer array wi 1 min read numpy.fmin() in Python numpy.fmin() function is used to compute element-wise minimum of array elements. This function compare two arrays and returns a new array containing the element-wise minima. If one of the elements being compared is a NaN, then the non-nan element is returned. If both elements are NaNs then the first 2 min read numpy.nonzero() in Python numpy.nonzero()function is used to Compute the indices of the elements that are non-zero. It returns a tuple of arrays, one for each dimension of arr, containing the indices of the non-zero elements in that dimension. The corresponding non-zero values in the array can be obtained with arr[nonzero(ar 2 min read numpy.nanmin() in Python numpy.nanmin()function is used when to returns minimum value of an array or along any specific mentioned axis of the array, ignoring any Nan value. Syntax : numpy.nanmin(arr, axis=None, out=None) Parameters : arr :Input array. axis :Axis along which we want the min value. Otherwise, it will consider 2 min read numpy.minimum() in Python numpy.minimum() function is used to find the element-wise minimum of array elements. It compare two arrays and returns a new array containing the element-wise minima. If one of the elements being compared is a NaN, then that element is returned. If both elements are NaNs then the first is returned. 2 min read numpy.atleast_1d() in Python numpy.atleast_1d()function is used when we want to Convert inputs to arrays with at least one dimension. Scalar inputs are converted to 1-dimensional arrays, whilst higher-dimensional inputs are preserved. Syntax : numpy.atleast_1d(*arrays) Parameters : arrays1, arrays2, ... : [array_like] One or mo 2 min read numpy.count() in Python numpy.core.defchararray.count(arr, substring, start=0, end=None): Counts for the non-overlapping occurrence of sub-string in the specified range. Parameters: arr : array-like or string to be searched. substring : substring to search for. start, end : [int, optional] Range to search in. Returns : An 1 min read Like