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__。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。
