Python | Numpy MaskedArray .__ ixor __ ()

numpy.ma.MaskedArray class is a subclass of ndarray for manipulating numeric arrays with missing data. With Numpy MaskedArray .__ ixor__ we can get XOR elements by value, which is provided as a parameter in the MaskedArray .__ ixor __ () method.

Syntax: numpy.MaskedArray .__ ixor __ ($ self, value, /)

Return: Return self ^ = value.

Example # 1:
In this example, we can see that each element is XOR by value, which is passed as a parameter to the MaskedArray method .__ ixor __ ().

# import an important module into python

import numpy as np 

 
# make an array with NumPy

gfg = np.ma.array ([ 1 , 2 , 3 , 4 , 5 ]) 

 
# applying MaskedArray .__ ixor __ () method

print ( gfg .__ ixor __ ( 2 )) 

  

Exit:

 [3 0 1 6 7] 

Example # 2:

# import an important module into python

import numpy as np 

  
# make an array with NumPy

gfg = np.ma.array ([[ 1 , 2 , 3 , 4 , 5 ], 

[ 6 , 5 , 4 , 3 , 2 ]]) 

  
# applying MaskedArray .__ ixor __ () method

print (gfg .__ ixor __ ( 1 )) 

Exit:

 [[0 3 2 5 4] [7 4 5 2 3 ]]