📜  numpy.ma.mask_or()函数| Python

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

numpy.ma.mask_or()函数| Python

numpy.ma.mask_or()函数将两个掩码与 logical_or运算符组合在一起。如果另一个是 nomask(即 False),则结果可能是 m1 或 m2 上的视图。

代码#1:

# Python program explaining
# numpy.ma.mask_or() function
  
# importing numpy as geek  
# and numpy.ma module as ma 
import numpy as geek 
import numpy.ma as ma 
  
m1 = geek.ma.make_mask([1, 1, 0, 1])
m2 = geek.ma.make_mask([1, 0, 0, 0])
  
gfg = geek.ma.mask_or(m1, m2)
  
print (gfg)

输出 :

[ True  True False  True]


代码#2:

# Python program explaining
# numpy.ma.mask_or() function
  
# importing numpy as geek  
# and numpy.ma module as ma 
import numpy as geek 
import numpy.ma as ma 
  
m1 = geek.ma.make_mask([1, 0, 0, 0])
m2 = geek.ma.make_mask([1, 1, 0, 1])
  
gfg = geek.ma.mask_or(m1, m2)
  
print (gfg)

输出 :

[ True  True False  True]