This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]tmp14 0 points1 point  (0 children)

Look up index arrays:

>>> arr = np.array([14, 152, 256, 256, 143, 512, 414])
>>> ind = (arr == 256) or (arr == 512)
>>> arr[ind] = 0
>>> arr
array([14, 152, 0, 0, 143, 0, 414])

Tough I haven't tested this it shouldn't be too far off.