当前位置:首页 » python教程 » 正文

在Python中通过threshold创建mask方式

看: 983次  时间:2020-07-29  分类 : python教程

我就废话不多说了,直接上代码吧!

【code】

import numpy as np

threshold=2
a=np.array([[1,2,3],[3,4,5]])
b=a>threshold

print("a="+str(a))
print("b="+str(b))

【result】

a=[[1 2 3]
 [3 4 5]]
b=[[False False True]
 [ True True True]]

以上这篇在Python中通过threshold创建mask方式就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持python博客。

标签:numpy  

<< 上一篇 下一篇 >>

搜索

推荐资源

  Powered By python教程网   鲁ICP备18013710号
python博客 - 小白学python最友好的网站!