Find index of elment with where
import numpy as np
v = np.array([1,0, 1, 2, 1, 1, 1, 2, 0, 0, 2])
np.where(v >= 2, 1, 0)
array([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1])
import numpy as np
v = np.array([1,0, 1, 2, 1, 1, 1, 2, 0, 0, 2])
np.where(v >= 2, 1, 0)
array([0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 1])