Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
有没有一种麻木的方式
n = [x-t if x > 0 else x for x in nps]
类似于这个
n = np.array(a) n[np.abs(n) < t] = 0
可能是这样的?
n[n > 0] = n-t
现在无法测试,但请尝试
np.where(n > 0, n - t, n)
查看文档