Instagram
youtube
Facebook
Twitter

Compute Minimum Value of Each Group in Pandas DataFrame

A Compute Minimum Value of Each Group in Pandas DataFrame?
Code Explanation:
● Grouping: Data is grouped based on 'Group'.

● Aggregation: Minimum value per group is computed using .min().

● Store Result: Result is saved in group_min.

● Output Display: Minimum values per group are printed.

 

Program:

import pandas as pd

group_min = df.groupby('Group')['Value'].min()

print(group_min)