Python | Numpy ndarray .__ ipow __ ()



Using the Numpy ndarray .__ ipow __ () method we will get all the elements with the value specified as a parameter in numpy.ndarray .__ ipow __ () .

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

Return: self ** = value

Example # 1:
In this example, we can see that each item receives power with the value specified as a parameter in ndarray .__ ipow __ () .

# import important module into python

import numpy as np

 
# make an array with NumPy

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

 
# applying the ndarray method .__ ipow __ ()

print (gfg .__ ipow __ ( 3 ))

Exit:

 [1 8 27 64 125] 

Example # 2:

# import an important module into python

import numpy as np

 
# make array with NumPy

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

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

 
# applying the ndarray .__ ipow __ () method

print (gfg .__ ipow __ ( 2 ))

Output:

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