Cannot get groupby records based on their minimum value using pandas in python

后端 未结 5 545
粉色の甜心
粉色の甜心 2021-01-23 00:15

I have the following csv

id;price;editor
k1;10,00;ed1
k1;8,00;ed2
k3;10,00;ed1
k3;11,00;ed2
k2;10,50;ed1
k1;9,50;ed3

If I do the following

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-23 00:38

    get rid of the editor part:

    df_reduced= df.groupby(['id'])['price'].min()
    

    no need to include 'transformed' as somebody else stated

提交回复
热议问题