Say that you have a list values = [3,6,1,5], and need the index of the smallest element, i.e. index_min = 2 in this case.

Avoid the solution with itemgetter() presented in the other answers, and use instead

index_min = min(range(len(values)), key=values.__getitem__)

because it doesn't require to import operator nor to use enumerate, and it is always faster(benchmark below) than a solution using itemgetter().

If you are dealing with numpy arrays or can afford numpy as a dependency, consider also using

import numpy as np
index_min = np.argmin(values)

This will be faster than the first solution even if you apply it to a pure Python list if:

  • it is larger than a few elements (about 2**4 elements on my machine)
  • you can afford the memory copy from a pure list to a numpy array

as this benchmark points out:

I have run the benchmark on my machine with python 2.7 for the two solutions above (blue: pure python, first solution) (red, numpy solution) and for the standard solution based on itemgetter() (black, reference solution). The same benchmark with python 3.5 showed that the methods compare exactly the same of the python 2.7 case presented above

Answer from gg349 on Stack Overflow
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-find-index-of-maximum-item-in-list
Python - Find index of maximum item in list - GeeksforGeeks
July 4, 2025 - max() function finds the largest value and index() returns its position in the list. Itโ€™s efficient, readable and ideal for everyday use when working with standard Python lists.
Discussions

finding max in list
the max() function is a builtin. More on reddit.com
๐ŸŒ r/learnpython
7
1
December 19, 2020
[python] index of absolute maximum value in a list
I know how to get the index of the maximum value in a list. mylist = [-10,0,1] idx_max_value = max(xrange(len(mylist)), key=mylist.__getitem__) #>>> 2 However, I need it to take the abs(-10) and so the result will be 0. How can I do that? Thanks in advance. More on discourse.mcneel.com
๐ŸŒ discourse.mcneel.com
5
0
April 23, 2019
A quicker way to get min and max date from pandas series
10'000 items isn't very much. Record the times of the individual lines, e.g.: import time start = time.perf_counter() data['Date'] = pd.to_datetime(data['Date']) print(time.perf_counter() - start) start = time.perf_counter() print(data['Date'].min(), data['Date'].max()) print(time.perf_counter() - start) If the first step is the one that takes all the time (which I imagine it is because datetime conversion is slow and you're not even telling pandas the format so it will have to do a bunch of guessing) then consider just storing your dates in the datetime format in the first place. If you're reading from CSV or SQL then these both have options to do it automatically. More on reddit.com
๐ŸŒ r/learnpython
6
1
September 24, 2018
IndexError: list index out of range using dict...?

Hi! I'm working on a bot to reply with suggestions for common python problems. This might not be very helpful to fix your underlying issue, but here's what I noticed about your submission:

You appear to be using concatenation and the str function for building strings

Instead of doing something like

result = "Hello " + name + ". You are " + str(age) + " years old"

You should use string formatting and do

result = "Hello {}. You are {} years old".format(name, age)

See the python tutorial for more information.

More on reddit.com
๐ŸŒ r/learnpython
4
0
June 1, 2015
๐ŸŒ
Python.org
discuss.python.org โ€บ ideas
A command to return the maximum index of a list or array - the better len - Ideas - Discussions on Python.org
June 12, 2022 - Hello ๐Ÿ˜ƒ, short form: Letโ€™s have something called like lix() that is defined as len()-1, please! def lix(obj, /): return len(obj) - 1 Motivation: When I started coding in python a few years ago, I did not understand the general use, why len() returns one more than the maximum valid index.
๐ŸŒ
Reddit
reddit.com โ€บ r/learnpython โ€บ finding max in list
r/learnpython on Reddit: finding max in list
December 19, 2020 -
#I have 2 lists. First, i need to find the max value in list one. the value i want #from list 2 should be the one found in the same index as the max in list one. 

#example: since 135 is larger, i want to return 15
#because 135 is index 1, and 15 is index 1.
LIST_1 = [101,135]
LIST_2=[20,15]

#i would really appreciate any help, any hints! :D
๐ŸŒ
30 Seconds of Code
30secondsofcode.org โ€บ home โ€บ list โ€บ index of min or max element
Python - Index of min or max element - 30 seconds of code
July 18, 2024 - To find the index of the element with the minimum or maximum value in a list, you can use the min() and max() functions to get the minimum or maximum value in the list, and then use the list.index() method to find the index of that value. def ...
Find elsewhere
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-maximum-minimum-elements-position-list
Position of maximum and minimum element in a list - Python - GeeksforGeeks
April 14, 2025 - The easiest way to find the position of the maximum and minimum elements in a list is by using Python's built-in max() and min() functions along with index():
๐ŸŒ
TutorialsPoint
tutorialspoint.com โ€บ article โ€บ find-the-index-of-maximum-item-in-a-list-using-python
Find the Index of Maximum Item in a List using Python
March 27, 2026 - Index of first maximum value: 0 All indices of maximum values: [0, 4] Use list.index(max(list)) for simple cases. Use enumerate() with max() for better performance when you need both value and index.
๐ŸŒ
PythonForBeginners.com
pythonforbeginners.com โ€บ home โ€บ find the index of max value in a list in python
Find the Index of Max Value in a List in Python - PythonForBeginners.com
June 3, 2022 - In this article, we have discussed different ways to find the index of max value in a list in python. If you need to find only the index of the first occurrence of the max value, you can use the approach with the max() function and the index() method.
๐ŸŒ
Spark By {Examples}
sparkbyexamples.com โ€บ home โ€บ python โ€บ get index of max of list in python
Get Index of Max of List in Python - Spark By {Examples}
March 27, 2024 - How to get the index of the maximum (max) element of the list in Python? If you want to return the maximum element index position from the given list, you
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ library โ€บ functions.html
Built-in Functions โ€” Python 3.14.6 documentation
The key argument specifies a one-argument ordering function like that used for list.sort(). The default argument specifies an object to return if the provided iterable is empty. If the iterable is empty and default is not provided, a ValueError is raised. If multiple items are maximal, the function returns the first one encountered.
๐ŸŒ
McNeel Forum
discourse.mcneel.com โ€บ scripting
[python] index of absolute maximum value in a list - Scripting - McNeel Forum
April 23, 2019 - I know how to get the index of the maximum value in a list. mylist = [-10,0,1] idx_max_value = max(xrange(len(mylist)), key=mylist.__getitem__) #>>> 2 However, I need it to take the abs(-10) and so the result will be 0โ€ฆ
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ index-of-max-element-13687
Index of Max Element in Python | LabEx
Use the built-in list.index() function to find the index of the first occurrence of the maximum value in the list.
๐ŸŒ
Tutorialspoint
tutorialspoint.com โ€บ python โ€บ list_max.htm
Python List max() Method
marks = [880, 946, 934, 989, 781] ... the program above, the output is achieved as follows โˆ’ ยท Chris ranked first with 989 marks ยท python_lists.htm ยท...
๐ŸŒ
Medium
medium.com โ€บ @satyam-hsmishra โ€บ find-the-max-and-min-index-value-of-the-python-list-136dc4697e0d
Find the max and min index value of the Python list - Satyam - Medium
January 21, 2021 - In the give list, we have a total of 7 elements in which the highest value is placed at position 4 which is 10 and the lowest value is at position 6 which is 0, as we know enumerate is a builtin python module and its adds counter to an iterable ...
๐ŸŒ
LabEx
labex.io โ€บ tutorials โ€บ python-how-to-find-max-indexes-in-python-lists-451213
How to find max indexes in Python lists | LabEx
Learn efficient techniques to find maximum value indexes in Python lists using built-in functions, list comprehension, and advanced indexing methods for data analysis and manipulation.
๐ŸŒ
Note.nkmk.me
note.nkmk.me โ€บ home โ€บ python
Find the Index of an Item in a List in Python | note.nkmk.me
July 27, 2023 - You can find the index of the maximum or minimum value in a list by passing the result of max() or min() to the index() method. Get the n-largest/smallest elements from a list in Python
๐ŸŒ
Python documentation
docs.python.org โ€บ 3 โ€บ howto โ€บ sorting.html
Sorting Techniques โ€” Python 3.14.6 documentation
For instance, if the student grades ... The standard library provides several tools that do less work than a full sort: min() and max() return the smallest and largest values, respectively....
๐ŸŒ
W3Schools
w3schools.com โ€บ python โ€บ ref_list_index.asp
Python List index() Method
Remove List Duplicates Reverse a String Add Two Numbers ยท Python Examples Python Compiler Python Exercises Python Quiz Python Challenges Python Practice Problems Python Server Python Syllabus Python Study Plan Python Interview Q&A Python Bootcamp Python Training ... The index() method returns the position at the first occurrence of the specified value.