Extract indexes of which elements are lower than a threshold in numpy
How to extract indexes of which elements are lower than a threshold in numpy matrix and then set this indexes to values zero in another same size matrix?
for example:
input = [2 3 4 1 6 2 1 7 8]
other_same_array = [12 2 -1 4 2 6 9 3 1]
if threshold = 3
output = [0 2 -1 0 2 0 0 3 1]
and this is my code:
m = np.where(input < threshold)
other_same_array[m] = 0