Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
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...
asked
Oct 12, 2021
in
Python
by
rajeshsharma
Q:
Write a program in Python for getting indices of N maximum values in a NumPy array.
n-maximum-value
numpy-array
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]
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
+1
vote
Q: Write a program in Java to create a doubly linked list containing n nodes.
asked
May 13, 2021
in
JAVA
by
rajeshsharma
#doubly-linked-list
java
nodes
+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
0
votes
Q: How to remove values from a Python array?
asked
May 17, 2020
in
Python
by
SakshiSharma
#python-array
#array-python
...