numpy.ma.MaskedArray class
是ndarray的子類,旨在處理缺少數據的數字數組。借助Numpy MaskedArray .__ rlshift__方法,我們可以獲得按參數value<<self右移的元素。
用法: numpy.MaskedArray.__rlshift__
返回:返回value<<self
範例1:
在此示例中,我們可以看到每個元素都右移了作為參數傳遞的value<<self。
# 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.__rlshift__() method
print(gfg.__rlshift__(2))
輸出:
[ 4 8 16 32 64]
範例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.__rlshift__() method
print(gfg.__rlshift__(1))
輸出:
[[ 2 4 8 16 32] [64 32 16 8 4]]
相關用法
- Python Numpy numpy.ndarray.__eq__()用法及代碼示例
- Python Numpy numpy.ndarray.__ne__()用法及代碼示例
- Python Numpy numpy.ndarray.__invert__()用法及代碼示例
- Python Numpy numpy.ndarray.__divmod__()用法及代碼示例
- Python Numpy numpy.ndarray.__neg__()用法及代碼示例
- Python Numpy numpy.ndarray.__mod__()用法及代碼示例
- Python Numpy numpy.ndarray.__xor__()用法及代碼示例
- Python Numpy numpy.ndarray.__truediv__()用法及代碼示例
- Python Numpy numpy.ndarray.__pos__()用法及代碼示例
- Python Numpy numpy.ndarray.__mul__()用法及代碼示例
- Python Numpy numpy.ndarray.__pow__()用法及代碼示例
- Python Numpy numpy.ndarray.__gt__()用法及代碼示例
- Python Numpy numpy.ndarray.__le__()用法及代碼示例
- Python Numpy numpy.ndarray.__lshift__()用法及代碼示例
- Python Numpy numpy.ndarray.__ge__()用法及代碼示例
注:本文由純淨天空篩選整理自Shivam_k大神的英文原創作品 Python | Numpy MaskedArray.__rlshift__。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。