Using numpy.where to alter elements of an array is easy enough
numpy.where
import numpy as np x = np.array([[5, 5], [2, 3]]) x[np.where(x > 4)] = 0