Python | Numpy MaskedArray .__ ipow__

Arrays | NumPy | Python Methods and Functions

numpy.ma.MaskedArray class is a subclass of ndarray for manipulating numeric arrays with missing data. With Numpy MaskedArray .__ ipow__ we can get all the elements working with the value specified as a parameter in the MaskedArray method .__ ipow __ ().

Syntax: numpy.MaskedArray .__ ipow __ (other)

Return: Raise self to the power other, in place.

Example # 1:
In this example, we see that each item is powered with a value that is supplied as a parameter in the MaskedArray method .__ ipow __ ().

# import important module in python

import numpy as np 

  
# make an array with NumPy

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

  
# applying MaskedArray .__ ipow __ () method

print (gfg .__ ipow __ ( 3 )) 

Exit:

 [1 8 27 64 125]  

Example # 2:

# import important module into python

import numpy as np 

 
< code class = "comments"> # make an array with NumPy

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

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

 
# applying MaskedArray .__ ipow __ () method

print (gfg .__ ipow __ ( 2 )) 

Exit:

 [[1 4 9 16 25] [36 25 16 9 4]] 



Get Solution for free from DataCamp guru