[英]Numpy equivalent of if/else list comprehension
Is there a numpy way of doing 有没有做麻木的方法
n = [x-t if x > 0 else x for x in nps]
similar to this 与此类似
n = np.array(a)
n[np.abs(n) < t] = 0
something like this perhaps? 像这样的东西?
n[n > 0] = n-t
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.