Get the minimum value of column in python pandas

Get the minimum value of column in python pandas : In this tutorial we will learn How to get the minimum value of all the columns in dataframe of python pandas. How to get the minimum value of a specific column in python pandas using min() function.  

Create Dataframe:


import pandas as pd
import numpy as np

#Create a DataFrame
d = {
'Name':['Alisa','Bobby','jodha','jack','raghu','Cathrine',
'Alisa','Bobby','kumar','Alisa','Alex','Cathrine'],
'Age':[26,24,23,22,23,24,26,24,22,23,24,24],

'Score':[85,63,55,74,31,77,85,63,42,62,89,77]}

df = pd.DataFrame(d,columns=['Name','Age','Score'])
df

So the resultant dataframe will be

Get the minimum value of column in dataframe –python pandas 1

 

Get the minimum value of all the column in python pandas:


# get the minimum values of all the column in dataframe

df.min()

This gives the list of all the column names and its minimum value, so the output will be

Get the minimum value of column in dataframe –python pandas 2

 

Get the minimum value of a specific column in python pandas:

Example 1:


# get the minimum value of the column 'Age'

df['Age'].min()

This gives the minimum value of column Age so the output will be

22

 

Example 2:


# get the minimum value of the column 'Name'

df['Name'].min()

This gives the minimum value of column Name so the output will be

‘Alex’

 

previous-small Get the minimum value of column in dataframe –python pandas                                                                                                                next_small Get the minimum value of column in dataframe –python pandas