We wish to obtain the range (minimum and maximum) values of a column or a vector.
Note that while it is most common to compute the range for numeric data, we may compute the range (min and max values) for other data types to mean the following:
In this example, we wish to obtain the minimum and maximum values of the column col_1
of the data frame df
.
df['col_1'].min()
df['col_1'].max()
Here is how this works:
We use the methods min()
and max()
of a Pandas Series
to obtain the minimum and maximum value of a Series
respectively.
Alternative: via Built-In Functions
In this example, we wish to obtain the minimum and maximum values of a list called my_list
.
min(my_list)
max(my_list)
Here is how this works:
min()
and max()
to obtain the minimum and maximum values of the list my_list
.min()
and max()
may be applied to both Series and non-Series vector objects such as lists.