I have two pandas data frames A
and B
. B
is a subset of A.
I want to delete all numbers from A if it's in B. But, if a number occurs two times in A and 1 time in B then it will only delete 1 occurrence of the number from A.
Here is my sample data sets:
df_A df_B
[Test] [Test]
1 1
2 2
3 5
2 5
4
5
5
After the operation I want new data frame c as
df_C
[Test]
3
2
4
Can you please suggest how to do that?
The suggested duplicate removes all occurrences from A
if present in B
, not just the first N occurrences.