numpy.argsort descending code example Example 1: np.argsort reverse arr.argsort()[::-1] Example 2: argsort in descending order numpy avgDists.argsort()[::-1][:n]