Pandas: calculating the mean values of duplicate entries in a dataframe

前端 未结 2 2006
情深已故
情深已故 2021-02-02 13:00

I have been working with a dataframe in python and pandas that contains duplicate entries in the first column. The dataframe looks something like this:

    sampl         


        
2条回答
  •  天命终不由人
    2021-02-02 13:35

    Groupby will work.

    data.groupby('sample_id').mean()
    

    You can then use reset_index() to make look exactly as you want.

提交回复
热议问题