Instagram
youtube
Facebook
Twitter

Compute the Minimum Value of a Column in a Pandas DataFrame

Compute the Minimum Value of a Column in a Pandas DataFrame

Short Description of the Program:
This program finds the minimum value in the 'Age' column of a Pandas DataFrame using the .min() function.

Explanation:

  • df['Age'] selects the Age column.
     
  • .min() returns the smallest value in that column.
     
  • Helps identify the youngest age or minimum measurement in a dataset.
     

Program:

import pandas as pd

data = {

    'Name': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eva', 'Frank'],

    'Age': [25, 30, 22, 28, 26, 35],

    'Gender': ['Female', 'Male', 'Male', 'Female', 'Female', 'Male'],

    'City': ['New York', 'Los Angeles', 'Chicago', 'Houston', 'Phoenix', 'Seattle']
}
df = pd.DataFrame(data)

min_age = df['Age'].min()

print("Minimum Age:", min_age)