Python | Numpy MaskedArray .__ and__

numpy.ma.MaskedArray class is a subclass of ndarray for manipulating numeric arrays with missing data. With the Numpy method MaskedArray .__ and__ we can get the elements that are added as a value as a parameter.

Syntax: numpy. MaskedArray .__ and__

Return: Return self & amp; value.

Example # 1:
In this example, we can see that each element has a value passed as a parameter.

 
# 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 the MaskedArray method .__ and __ ()

print (gfg .__ and __ ( 2 )) 

Output:

 [0 2 2 0 0] 

Example # 2:

# import 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 the MaskedArray method .__ and __ ()

print (gfg .__ and __ ( 1 )) 

Exit:

 [[1 0 1 0 1] [0 1 0 1 0]]