Login
Remember
Register
Ask a Question
Write a program in Python for getting indices of N maximum values in a NumPy array.
0
votes
asked
Oct 12, 2021
in
Python
by
rajeshsharma
Write a program in Python for getting indices of N maximum values in a NumPy array.
n-maximum-value
numpy-array
Python-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Oct 12, 2021
by
rajeshsharma
import numpy as np
arr = np.array([1, 3, 2, 4, 5])
print(arr.argsort()[-3:][::-1])
Output:
[4 3 1]
...