0

Existing Dataframe :

Group        Payer_ID          status          Payment_Amount
 A              11               P                 100
 A              12               P                 100
 A              13               Q                  50
 A              14               P                 100
 A              15               P                  -
 B              11               P                  10
 B              16               Q                 150

Expected Dataframe :

Group        Payer_ID              Payment_Amount
 A              11                      100
 B              16                      150

if Payment amount is same it should take the first Payer_ID

by below code i could get the max payment amount but need to fetch the respective Payer_ID as well

what changes needs to be done.?

Max_Payment_Amt = df.groupby('Group',as_index=False)['Payment_Amount'].max()
Roshankumar
  • 365
  • 1
  • 8

0 Answers0