Using Pandas to Find Minimum Values of Grouped Rows

前端 未结 2 1698
感情败类
感情败类 2021-01-12 04:04

This might be a trivial question but I\'m still trying to figure out pandas/numpy.

So, suppose I have a table with the following structure:

group_id          


        
2条回答
  •  孤城傲影
    2021-01-12 04:41

    To get the minimum of column A for each group use transform

    df.groupby('group_id')['A'].transform('min')
    

提交回复
热议问题