Подготовка:
>>> ar = np.ma.array(np.round(np.random.normal(50, 10, 20), 1),
mask=np.random.binomial(1, .2, 20)).reshape((4,5))
>>> print(ar)
[[59.9 51.3 -- 19.7 --]
[59.1 57.2 48.6 49.8 46.3]
[51.1 61.6 36.9 52.2 51.7]
[37.9 -- -- 53.1 57.5]]
>>> sorted_ind = ar.argsort(axis=None)
>>> sorted_ind
array([ 3, 12, 15, 9, 7, 8, 10, 1, 14, 13, 18, 6, 19, 5, 0, 11, 4,
2, 16, 17])
Тогда новый материал
>>> flat = ar.flatten()
>>> leq_ind = filter(lambda x: flat[x] <= 51.1, sorted_ind)
>>> leq_ind
[3, 12, 15, 9, 7, 8, 10]
>>> geq_ind = filter(lambda x: flat[x] >= 51.1, sorted_ind)
>>> geq_ind
[10, 1, 14, 13, 18, 6, 19, 5, 0, 11]