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
Can't test now, but try
np.where(n > 0, n - t, n)
See documentation
2.1m questions
2.1m answers
60 comments
57.0k users