🌐
Vultr Docs
docs.vultr.com › python › third party › numpy › argmax()
Python Numpy argmax() - Find Maximum Index
April 10, 2025 - Consider a two-dimensional array. Apply np.argmax() without specifying an axis to find the overall maximum index. Use the axis parameter to get the index of the max value in a 2D NumPy array along a specified axis.
People also ask

How does NumPy handle multiple maximum values?
If the maximum value appears more than once in an array, np.argmax() is designed to return the index of the first occurrence only. It does not provide a list of all positions where the maximum exists. If you require the indices of all instances, you should use np.where() or np.argwhere() instead.
🌐
arhfoundation.org
arhfoundation.org › numpy-argmax-index-python
Get Index of Max Value in NumPy Array (Python Guide) [Efficient] ...
Can I use argmax on a multi-dimensional array?
Yes, np.argmax() works on multi-dimensional arrays. By default, it treats the array as a flattened 1D array and returns a single integer index. To find the index along a specific dimension, you can use the axis parameter. For retrieving the multi-dimensional coordinates (e.g., row and column), you should wrap the result in np.unravel_index(), passing both the argmax result and the shape of the original array.
🌐
arhfoundation.org
arhfoundation.org › numpy-argmax-index-python
Get Index of Max Value in NumPy Array (Python Guide) [Efficient] ...
What is the difference between np.argmax() and np.max()?
The fundamental difference lies in the type of data returned. np.max() returns the actual maximum numerical value found within the array. In contrast, np.argmax() returns the index, or the position, of that maximum value. While the former tells you what the largest number is, the latter tells you where it is located.
🌐
arhfoundation.org
arhfoundation.org › numpy-argmax-index-python
Get Index of Max Value in NumPy Array (Python Guide) [Efficient] ...
🌐
DataCamp
datacamp.com › doc › numpy › argmax
NumPy argmax()
NumPy's `argmax()` function is used in array computation and analysis to find the index of the maximum value within an array.
🌐
NumPy
numpy.org › doc › 2.2 › reference › generated › numpy.argmax.html
numpy.argmax — NumPy v2.2 Manual
Indexes of the maximal elements of a N-dimensional array: >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) >>> ind (1, 2) >>> a[ind] 15 · >>> b = np.arange(6) >>> b[1] = 5 >>> b array([0, 5, 2, 3, 4, 5]) >>> np.argmax(b) # Only the first occurrence is returned.
🌐
Analytics Vidhya
analyticsvidhya.com › home › all you need to know about numpy’s argmax() function
All You Need to Know About NumPy's argmax() Function
May 28, 2025 - To find the maximum value index along a specific axis in a multi-dimensional array, we can specify the axis parameter in the np.argmax() function. This allows us to find the maximum value and corresponding index along a particular dimension.
🌐
w3resource
w3resource.com › python-exercises › numpy › python-numpy-exercise-120.php
Python NumPy: Get the index of a maximum element in a numpy array along one axis - w3resource
August 29, 2025 - # Importing the NumPy library and ... np.unravel_index() to get the indices of the maximum element in the array 'a' # The argmax() function finds the index of the maximum value in the flattened array # The unravel_index() function ...
Find elsewhere
🌐
Statology
statology.org › home › how to get the index of max value in numpy array
How to Get the Index of Max Value in NumPy Array
July 29, 2022 - If we look at the original array, we can see that the value in index position 2 is 9, which is indeed the maximum value in the array. The following code shows how to get the index of the max value in each row of a multi-dimensional NumPy array:
🌐
NumPy
numpy.org › doc › stable › reference › generated › numpy.argmax.html
numpy.argmax — NumPy v2.5 Manual
Indexes of the maximal elements of an N-dimensional array: >>> a.flat[np.argmax(a)] 15 >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) >>> ind (1, 2) >>> a[ind] 15 · >>> b = np.arange(6) >>> b[1] = 5 >>> b array([0, 5, 2, 3, 4, 5]) >>> np.argmax(b) # Only the first occurrence is returned.
🌐
Arhfoundation
arhfoundation.org › numpy-argmax-index-python
Get Index of Max Value in NumPy Array (Python Guide) [Efficient] - ArhFoundation.org
April 3, 2026 - To get the index of the max value in a NumPy array in Python, the most efficient method is using the np.argmax() function. This function returns the indices of the maximum values along an axis, providing a direct way to locate elements in both simple and complex datasets.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-find-index-of-maximum-item-in-list
Python - Find index of maximum item in list - GeeksforGeeks
July 4, 2025 - ... Explanation: np.argmax(a) returns the index of the maximum value in the list a . Here, the largest value is 22 and since indexing starts at 0, its position is 6. So, the output is 6. By converting the list to a Series, you can use the idxmax() ...
🌐
ListenData
listendata.com › home › python
NumPy argmax() Function : Learn with Examples
When we use axis=1 argument in the argmax() function, it means that we want to find the indices of the maximum elements along each row of the array. In simple words, it returns the index of the maximum value for each row.
🌐
IncludeHelp
includehelp.com › python › how-to-get-the-index-of-a-maximum-element-in-a-numpy-array-along-one-axis.aspx
Python - How to get the index of a maximum element in a NumPy array along one axis?
December 26, 2022 - To let the compiler know that we want the index of the maximum element along the rows of the array, we need to pass the argument as 'axis=0'. ... # Import numpy import numpy as np # Creating a numpy array arr = np.array([1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8,1,2,3,4,5,6,7,8]) # Display original array ...
🌐
Skytowner
skytowner.com › explore › getting_indices_of_n_maximum_values_in_numpy
Getting indices of N maximum values in NumPy
To get the indices of N maximum values in NumPy in an optimal way, use the argpartition(~) method. The argpartition(~) method allows you to select an index by which to partition, and ensures that all values at indices smaller than the value at this index appear before it, and all values at ...
🌐
Educative
educative.io › answers › how-to-get-indices-of-n-maximum-values-in-numpy-arrays
How to get indices of N maximum values in NumPy arrays
In order to get the indices of N maximum values in a NumPy array, we can use the argsort() function.
🌐
NumPy
numpy.org › doc › 2.0 › reference › generated › numpy.argmax.html
numpy.argmax — NumPy v2.0 Manual
Indexes of the maximal elements of a N-dimensional array: >>> ind = np.unravel_index(np.argmax(a, axis=None), a.shape) >>> ind (1, 2) >>> a[ind] 15 · >>> b = np.arange(6) >>> b[1] = 5 >>> b array([0, 5, 2, 3, 4, 5]) >>> np.argmax(b) # Only the first occurrence is returned.
🌐
Cmu
jitsi.cmu.edu.jm › home › python: get index of max value in list + tips
Python: Get Index of Max Value in List + Tips
February 10, 2025 - Specifically, NumPy’s `argmax()` function directly returns the index of the maximum value within a NumPy array. This contrasts with standard Python lists, where a combination of `max()` and `index()` is often required.
🌐
Real Python
realpython.com › numpy-max-maximum
NumPy's max() and maximum(): Find Extreme Values in Arrays – Real Python
October 22, 2025 - Addressing the array elements is straightforward. NumPy’s indices start at zero, like all Python sequences. By convention, a two-dimensional array is displayed so that the first index refers to the row, and the second index refers to the column.