0 votes
in Python by
Write a program in Python for getting indices of N maximum values in a NumPy array.

1 Answer

0 votes
by
import numpy as np

arr = np.array([1, 3, 2, 4, 5])

print(arr.argsort()[-3:][::-1])

Output:

[4 3 1]
...