Python | Numpy MaskedArray .__ iand __ ()



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

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

Return: Return self & amp; = value.

Example # 1:
In this example, we can see that each element has a value passed as a parameter to the MaskedArray method .__ iand __ ().

# 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 .__ iand __ ()

print (gfg .__ iand __ ( 2 )) 

 

Exit:

 [0 2 2 0 0] 

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

prin t (gfg .__ iand __ ( 1 )) 

Exit:

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