set diag elements to zero, then use argsort()
to find the top-K index in a flatten array, and use unravel_index()
convert 1D index to 2D index:
result[np.diag_indices_from(result)] = 0.0
idx = np.argsort(result, axis=None)[-10:]
midx = np.unravel_index(idx, result.shape)
print midx
print result[midx]
result:
(array([ 8, 14, 1, 0, 11, 17, 8, 10, 6, 8]), array([14, 8, 0, 1, 17, 11, 10, 8, 8, 6])) [ 0.2329741 0.2329741 0.2379527 0.2379527 0.25723394 0.25723394 0.26570327 0.26570327 0.34954834 0.34954834]