numpy.equal() in Python Last Updated : 21 Jun, 2022 Comments Improve Suggest changes Like Article Like Report numpy.equal(arr1, arr2, out = None, where = True, casting = 'same_kind', order = 'K', dtype = None, ufunc 'not_equal') : This logical function checks for arr1 == arr2 element-wise. Parameters : arr1 : [array_like]Input array arr2 : [array_like]Input array out : [ndarray, optional]Output array with same dimensions as Input array, placed with result. **kwargs : allows you to pass keyword variable length of argument to a function. It is used when we want to handle named argument in a function. where : [array_like, optional]True value means to calculate the universal functions(ufunc) at that position, False value means to leave the value in the output alone. Return : Returns arr1 == arr2 element-wise Code 1 : Python3 # Python Program illustrating # numpy.equal() method import numpy as geek a = geek.equal([1., 2.], [1., 3.]) print("Check to be Equal : \n", a, "\n") b = geek.equal([1, 2], [[1, 3],[1, 4]]) print("Check to be Equal : \n", b, "\n") Output : Check to be Equal : [ True False] Check to be Equal : [[ True False] [ True False]] Code 2 : Comparing data-type using .equal() function Python3 # Python Program illustrating # numpy.equal() method import numpy as geek # Here we will compare Complex values with int a = geek.array([0 + 1j, 2]) b = geek.array([1,2]) d = geek.equal(a, b) print("Comparing complex with int using .equal() : ", d) Output : Comparing complex with int using .equal() : [False True] Code 3 : Python3 # Python Program illustrating # numpy.not_equal() method import numpy as geek # Here we will compare Float with int values a = geek.array([1.1, 1]) b = geek.array([1, 2]) d = geek.not_equal(a, b) print("\nComparing float with int using .not_equal() : ", d) Output : Comparing float with int using .not_equal() : [ True True] Time complexity : equal has time complexity of O(N). Where k is the length of list which need to be added. References : https://docs.scipy.org/doc/numpy-1.13.0/reference/generated/numpy.equal.html . Comment More infoAdvertise with us Next Article numpy.equal() in Python mohit gupta_omg :) Follow Improve Article Tags : Python Python-numpy Python numpy-Logic Functions Practice Tags : python Similar Reads numpy.not_equal() in Python The numpy.not_equal() checks whether two element are unequal or not. Syntax : numpy.not_equal(x1, x2[, out])Parameters : x1, x2 : [array_like]Input Array whose elements we want to checkout : [ndarray, optional]Output array that returns True/False. A placeholder the same shape as x1 to store the resu 2 min read 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.array_equal() in Python numpy.array_equal(arr1, arr2) : This logical function that checks if two arrays have the same shape and elements. Parameters : arr1 : [array_like]Input array or object whose elements, we need to test. arr2 : [array_like]Input array or object whose elements, we need to test. Return : True, if both ar 1 min read numpy.greater_equal() in Python The numpy.greater_equal() checks whether x1 >= x2 or not. Syntax : numpy.greater_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 are sca 2 min read numpy.greater() in Python The numpy.greater() checks whether x1 is greater than x2 or not. Syntax : numpy.greater(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 scala 2 min read numpy.array_equiv() in Python numpy.array_equiv(arr1, arr2) : This logical function that checks if two arrays have the same elements and shape consistent. Shape consistent means either they are having the same shape, or one input array can be broadcasted to create the same shape as the other one. Parameters : arr1 : [array_like] 2 min read numpy.isnan() in Python The numpy.isnan() function tests element-wise whether it is NaN or not and returns the result as a boolean array. Syntax :Â numpy.isnan(array [, out]) Parameters :Â array : [array_like]Input array or object whose elements, we need to test for infinity out : [ndarray, optional]Output array placed wit 2 min read Python | Pandas Index.equals() Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier. Pandas Index.equals() function determine if two Index objects contains the same elemen 2 min read Python | Numpy numpy.matrix.all() With the help of Numpy numpy.matrix.all() method, we are able to compare each and every element of one matrix with another or we can provide the axis on the we want to apply comparison. Syntax : numpy.matrix.all() Return : Return true if found match else false Example #1 : In this example we can see 1 min read Python | Numpy np.assert_equal() method With the help of np.assert_equal() method, we can get the assertion error when two objects are not equal by using np.assert_equal() method. Syntax : np.assert_equal(actual, desired) Return : Return assertion error if two object are unequal. Example #1 : In this example we can see that by using np.as 1 min read Like