Pandas groupby multiple columns, list of multiple columns

前端 未结 4 881
庸人自扰
庸人自扰 2020-12-25 08:22

I have the following data:

Invoice NoStockCode Description                         Quantity    CustomerID  Country
536365  85123A      WHITE HANGING HEART T-         


        
4条回答
  •  隐瞒了意图╮
    2020-12-25 08:42

    Try using a variation of the following:

    df.groupby('company').product.agg([('count', 'count'), ('NoStockCode', ', '.join), ('Descrption', ', '.join), ('Quantity', ', '.join)])
    

提交回复
热议问题