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]

Related questions

+2 votes
asked Jul 4, 2021 in NumPy by sharadyadav1986
+1 vote
asked Feb 15, 2021 in Python by SakshiSharma
...