col_rank = np.argsort(col_order, axis=0)
row_rank = np.argsort(row_order, axis=1)
n = 2
col_top_n = col_rank < n
row_top_n = row_rank < n
both_top_n = np.logical_and(row_top_n, col_top_n)
row_indices, col_indices = np.nonzero(both_top_n)
print('The following elements are in the top {} of both their rows and columns:'.format(
    n))
for row, column in zip(row_indices, col_indices):
    pass
How to find elements loactions is numpy array