0

I would like to show the ID's that have the same ID and different stat value.

Data

ID              name    tag         stat
aaBBB1234:3716  apv     eertyyuiiio FALSE
aaBBB1234:3716  mps     rtuui       FALSE
aaBBB1234:3716  ty      fgggll1     TRUE
bbSSS2333:5000  teas    dexcv       FALSE
bbSSS2333:5000  llv     ieeve       FALSE
        
        

Desired

ID              name tag            stat
aaBBB1234:3716  apv  eertyyuiiio    FALSE
aaBBB1234:3716  mps  rtuui          FALSE
aaBBB1234:3716  ty   fgggll1        TRUE

Doing

# Filter the dataframe based on the desired condition
filtered_df = df[df['ID'].duplicated]]

This filters, however this needs to be expanded to specifically show the ID's that have the same ID and different stat value. Any suggestion is appreciated.

Lynn
  • 4,292
  • 5
  • 21
  • 44

0 Answers0