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 dataframe.min()
function returns the minimum of the values in the given object. If the input is a series, the method will return a scalar which will be the minimum of the values in the series. If the input is a dataframe, then the method will return a series with minimum of values over the specified axis in the dataframe. By default the axis is the index axis.
Syntax:DataFrame.min(axis=None, skipna=None, level=None, numeric_only=None, **kwargs)
Parameters :
axis : Align object with threshold along the given axis.
skipna : Exclude NA/null values when computing the result
level : If the axis is a MultiIndex (hierarchical), count along a particular level, collapsing into a Series
numeric_only : Include only float, int, boolean columns. If None, will attempt to use everything, then use only numeric data. Not implemented for
Series.
Returns : min : Series or DataFrame (if level specified)
Example #1: Use min()
function to find the minimum value over the index axis.
import pandas as pd
df = pd.DataFrame({ "A" :[ 12 , 4 , 5 , 44 , 1 ],
"B" :[ 5 , 2 , 54 , 3 , 2 ],
"C" :[ 20 , 16 , 7 , 3 , 8 ],
"D" :[ 14 , 3 , 17 , 2 , 6 ]})
df
|

Lets use the dataframe.min()
function to find the minimum value over the index axis
Output :

Example #2: Use min()
function on a dataframe which has Na
values. Also find the minimum over the column axis.
import pandas as pd
df = pd.DataFrame({ "A" :[ 12 , 4 , 5 , None , 1 ],
"B" :[ 7 , 2 , 54 , 3 , None ],
"C" :[ 20 , 16 , 11 , 3 , 8 ],
"D" :[ 14 , 3 , None , 2 , 6 ]})
df
|

Lets implement the min function.
df. min (axis = 1 , skipna = True )
|
Output :
