python get max value in list and index code example
Example 1: python index of max value in list
a = [1, 7, 3, 12, 5]
min_index = a.index(min(a))
max_index = a.index(max(a))
Example 2: index to min python
import numpy as np
index_min = np.argmin(values)
Example 3: python how to return max num index
import numpy as np
x=[1,2,3,4,5]
max_index=np.argmax(x)
Example 4: index of maximum value in list python
[i for i, x in enumerate(l) if x == max(l)]
Example 5: python list max value
list1, list2 = [123, 'xyz', 'zara', 'abc'], [456, 700, 200]
print "Max value element : ", max(list1)
print "Max value element : ", max(list2)