Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Write a program in Python for getting indices of N maximum values in a NumPy array.
Home
Python
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]
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
+2
votes
Q: how to identified datatyp for numpy array?
asked
Jul 3, 2021
in
NumPy
by
sharadyadav1986
numpy-array
0
votes
Q: Which of the following function is used to covert NumPy array to Tensor?
asked
Aug 7, 2021
in
PyTorch
by
sharadyadav1986
numpy-array
0
votes
Q: Which of the following is used to convert NumPy array to Tensor?
asked
Aug 7, 2021
in
PyTorch
by
sharadyadav1986
numpy-array
0
votes
Q: Which of the following function is used to convert NumPy array to Tensor?
asked
Aug 7, 2021
in
PyTorch
by
sharadyadav1986
numpy-array
+2
votes
Q: how to identified last number of numpy array?
asked
Jul 4, 2021
in
NumPy
by
sharadyadav1986
numpy-array
+2
votes
Q: how to create 2D Array in NumPy?
asked
Jul 3, 2021
in
NumPy
by
sharadyadav1986
numpy-array
0
votes
Q: What Are Different Ways To Create An Empty NumPy Array In Python?
asked
Dec 22, 2019
in
Python
by
rajeshsharma
#python-array
Python-questions-answers
+1
vote
Q: Mentions the methods used for setting and getting cookie values?
asked
May 23, 2020
in
Python
by
sharadyadav1986
#django-cookie-method
#django-cookie-value
Python-questions-answers
0
votes
Q: How to remove values from a Python array?
asked
May 17, 2020
in
Python
by
SakshiSharma
#python-array
#array-python
Python-questions-answers
+1
vote
Q: Write A Program in Python to Print the following pattern
asked
Feb 15, 2021
in
Python
by
SakshiSharma
#python-program
progam-python
python-pattern
Python-questions-answers
...