Python | Pandas Index.argmin()
Last Updated :
16 Dec, 2018
Python is a great language for doing data analysis, primarily because of the fantastic ecosystem of data-centric python packages. Pandas is one of those packages and makes importing and analyzing data much easier.
Pandas Index.argmin()
function returns the indices of the minimum value present in the input Index. If we are having more than one minimum value (i.e. minimum value is present more than once) then it returns the index of the first occurrence of the minimum value.
Syntax: Index.argmin(axis=None)
Parameter: Doesn’t take any parameter
Example #1: Use Index.argmin()
function to find the index of the minimum value present in the given Index.
import pandas as pd
df = pd.Index([ 17 , 69 , 33 , 5 , 0 , 74 , 10 ])
df
|
Output :
Let’s find the index of the minimum value present in our Index.
Output :
4
As we can see in the output, The minimum value in the Index is 0 and its index is 4 so the output is 4.
Example #2: Use Index.argmin()
function to find the index of the minimum value when we are having minimum value repeated more than once.
import pandas as pd
df = pd.Index([ 17 , 69 , 33 , 5 , 10 , 74 , 10 , 5 ])
df
|
Output :
Let’s find the index of the minimum value.
Output :
3
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...