Good afternoon, I am new to programming, I would like to ask you for help with the following: I have two DataFrames df1 and df2
df1 is composed of the following registers:
ID | Nombre | Teléfono |
---|---|---|
C0001 | ANTONIO | 345 |
C0002 | LAURA | 326 |
C0003 | CAMILO | 289 |
C0004 | JOSE | 245 |
df2 is made up of these other registers:
ID | Nombre | Teléfono |
---|---|---|
C0001 | ANTONIO | 345 |
C0002 | LAURA | 326 |
C0003 | CAMILO | 289 |
C0004 | JOSE | 245 |
C0005 | NATALIA | 345 |
C0006 | ERIKA | 326 |
C0007 | LINA | 289 |
C0008 | CRISTINA | 245 |
I want to get a third df3 in this way which only contains the records where ID is unique
ID | Nombre | Teléfono | `` |
---|---|---|---|
C0005 | NATALIA | 345 | |
C0006 | ERIKA | 326 | |
C0007 | LINA | 289 | |
C0008 | CRISTINA | 245 |
I use the isin() method
x=df1.ID.isin(df2.ID)
but it shows the following, I would like to know how I can take the records that are false and show their information: 0 True 1 True 2 True 3 True 4 False 5 False 6 False 7 False
I need to get this result:
ID | Nombre | Teléfono |
---|---|---|
C0005 | NATALIA | 345 |
C0006 | ERIKA | 326 |
C0007 | LINA | 289 |
C0008 | CRISTINA | 245 |