numpy.ma.MaskedArray class
是ndarray的子類,旨在處理缺少數據的數字數組。借助Numpy MaskedArray .__ rtruediv__,我們可以分割在MaskedArray.__rtruediv__()方法中作為參數提供的特定值。
用法: numpy.MaskedArray.__rtruediv__
返回:selft除以other,然後返回一個新的蒙版數組。
範例1:
在此示例中,我們可以看到數組中的每個元素都用方法MaskedArray.__rtruediv__()中作為參數給出的值進行除法。
# import the important module in python
import numpy as np
# make an array with numpy
gfg = np.ma.array([22, 33, 44, 55, 77])
# applying MaskedArray.__rtruediv__() method
print(gfg.__rtruediv__(11))
輸出:
[0.5 0.3333333333333333 0.25 0.2 0.14285714285714285]
範例2:
# import the important module in python
import numpy as np
# make an array with numpy
gfg = np.ma.array([[10, 20, 30, 40, 50],
[110, 220, 330, 440, 550]])
# applying MaskedArray.__rtruediv__() method
print(gfg.__rtruediv__(10))
輸出:
[[1.0 0.5 0.3333333333333333 0.25 0.2] [0.09090909090909091 0.045454545454545456 0.030303030303030304 0.022727272727272728 0.01818181818181818]]
相關用法
- Python Numpy numpy.ndarray.__add__()用法及代碼示例
- Python Numpy numpy.ndarray.__sub__()用法及代碼示例
- Python Numpy numpy.ndarray.__mul__()用法及代碼示例
- Python Numpy numpy.ndarray.__truediv__()用法及代碼示例
- Python Numpy numpy.ndarray.__xor__()用法及代碼示例
- Python Numpy numpy.ndarray.__pos__()用法及代碼示例
- Python Numpy numpy.ndarray.__and__()用法及代碼示例
- Python Numpy numpy.ndarray.__neg__()用法及代碼示例
- Python Numpy numpy.ndarray.__isub__()用法及代碼示例
- Python Numpy numpy.ndarray.__rshift__()用法及代碼示例
- Python Numpy numpy.ndarray.__iadd__()用法及代碼示例
- Python Numpy numpy.ndarray.__pow__()用法及代碼示例
- Python Numpy numpy.ndarray.__lshift__()用法及代碼示例
- Python Numpy numpy.ndarray.__divmod__()用法及代碼示例
- Python Numpy numpy.ndarray.__invert__()用法及代碼示例
注:本文由純淨天空篩選整理自Shivam_k大神的英文原創作品 Python | Numpy MaskedArray.__rtruediv__。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。