Answers for "how to know index of max no. in python"

10

python index of max value in list

# any list
a = [1, 7, 3, 12, 5]

# index of minimum element
# if more than 1 minimum, 
# first index is returned
min_index = a.index(min(a))

# index of maximum element
max_index = a.index(max(a))
Posted by: Guest on May-03-2020
2

python how to return max num index

import numpy as np

x=[1,2,3,4,5]

max_index=np.argmax(x) 
# return the index of the maximun element
# max_index has the value 4
Posted by: Guest on June-07-2020
1

index of max value of sequence python

a.index(max(a))
a.index(min(a))

mean.max()    
max_index = (np.argmax(mean, axis = 0) + 1)
Posted by: Guest on November-08-2020

Code answers related to "how to know index of max no. in python"

Python Answers by Framework

Browse Popular Code Answers by Language