1In [304]: array = np.array([1, 1, 2, 3, 2, 1, 2, 3])
2
3In [305]: np.unique(array) # unique values in `array`
4Out[305]: array([1, 2, 3])
5
6In [306]: array == 1 # retrieve a boolean mask where elements are equal to 1
7Out[306]: array([ True, True, False, False, False, True, False, False])
8
9In [307]: (array == 1).nonzero()[0] # get the `True` indices for the operation above
10Out[307]: array([0, 1, 5])