I have two Pandas Dataframe df1
and df2
where df2
is a part of df1
and I want to create a Dataframe df3
, which contains all the rows from df1
that are not in df2
.
Here is an example :
print(df1)
>>
+---------+
| ID|
+---------+
| AAA|
| DDD|
| BBB|
| CCC|
| EEE|
| FFF|
+---------+
print(df2)
>>
+---------+
| ID|
+---------+
| AAA|
| EEE|
| FFF|
+---------+
print(df3)
>>
+---------+
| ID|
+---------+
| DDD|
| BBB|
| CCC|
+---------+
Note:
- My DataFrame might have multiple columns, but the matching must be done on the
ID
column only.