📜  Python| Numpy MaskedArray.__ipow__

📅  最后修改于: 2022-05-13 01:55:37.686000             🧑  作者: Mango

Python| Numpy MaskedArray.__ipow__

numpy.ma.MaskedArray class是 ndarray 的子类,旨在处理缺失数据的数值数组。在 Numpy MaskedArray.__ipow__的帮助下,我们可以使用 MaskedArray.__ipow__() 方法中作为参数提供的值来获取所有元素。

示例 #1:
在此示例中,我们可以看到每个元素都使用 MaskedArray.__ipow__() 方法中作为参数提供的值。

# import the important module in python 
import numpy as np 
      
# make an array with numpy 
gfg = np.ma.array([1, 2, 3, 4, 5]) 
      
# applying MaskedArray.__ipow__() method 
print(gfg.__ipow__(3)) 
输出:
[  1   8  27  64 125]


示例 #2:

# import the important module in 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.__ipow__() method 
print(gfg.__ipow__(2)) 
输出:
[[ 1  4  9 16 25]
 [36 25 16  9  4]]