Open In App

Python | Pandas Index.argmin()

Last Updated : 16 Dec, 2018
Improve
Improve
Like Article
Like
Save
Share
Report

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.




# importing pandas as pd
import pandas as pd
  
# Creating the Index
df = pd.Index([17, 69, 33, 5, 0, 74, 10])
  
# Print the Index
df


Output :

Let’s find the index of the minimum value present in our Index.




# function to return the index of the minimum value.
df.argmin()


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.




# importing pandas as pd
import pandas as pd
  
# Creating the Index
df = pd.Index([17, 69, 33, 5, 10, 74, 10, 5])
  
# Print the Index
df


Output :

Let’s find the index of the minimum value.




# We call the argmin() function to find the index of minimum value.
df.argmin()


Output :

3


Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads