In [11]: yy, xx = np.where(a%3 == 0) In [12]: yy Out[12]: array([0, 0, 1, 1, 2, 3, 3]) In [13]: xx Out[13]: array([0, 3, 1, 4, 2, 0, 3]) In [33]: np.where( (a>2) & (a<12) ) Out[33]: (array([0, 0, 1, 1, 1, 1, 1, 2, 2]), array([3, 4, 0, 1, 2, 3, 4, 0, 1]))