8

派手な方法はありますか

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
4

1 に答える 1