In pandas, you can use the groupby() method to group data by one or more columns and then use the agg() method to compute various statistics for each group.