replace all elements of python numpy array that are equal to some values

Try np.isin:

array[np.isin(array, some_values)] = 0

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top