  # Python | Numpy numpy.ndarray .__ ne __ ()

NumPy | Python Methods and Functions

With the Numpy method with numpy.ndarray .__ ne __ () we can determine which element of the array is not equals to the value specified in the parameter. It will return you an empty boolean array with only True and False values.

Syntax: ndarray .__ ne __ (\$ self, value, /)

Return: self! = value

Example # 1:
In this example, we can see that after applying ` numpy .__ ne __ () ` we get a simple boolean array that can tell us which element in the array is not equal to an element of the supplied parameter.

 ` # import important module in python ` ` import ` ` numpy as np `   ` # make an array with NumPy ` ` gfg ` ` = ` ` np.array ([` ` 1 ` `, ` ` 2 ` `, ` ` 3 ` `, ` ` 4 ` `, ` ` 5 ` `, ` ` 6 ` `]) `   ` # using the numpy method .__ ne __ () ` ` print ` ` (gfg .__ ne __ (` ` 4 ` `)) `

Output:

` [True True True False True True] `

Example # 2:

 ` # import an important module into python ` ` import ` ` numpy as np ` ` `  ` # make an array with NumPy ` ` gfg ` ` = ` ` np.array ([[` ` 1 ` `, ` ` 2 ` `, ` ` 3 ` `, ` ` 4 ` `, ` ` 5 ` `, ` ` 6 ` `], ` ` [` ` 6 ` `, ` ` 5 ` `, ` ` 4 ` `, ` ` 3 ` `, ` ` 2 ` `, ` ` 1 ` `]]) `   ` # applying the numpy method .__ ne __ () ` ` print ` ` (gfg .__ ne __ (` ` 4 ` `)) `

Exit:

` [[True True True False True True] [True True False True True True]] `