Set-up
I have 2 pandas dfs (df1 and df2) which contain some overlapping rows and some non-overlapping rows.
Both dfs have the columns order_id and shop.
Now, if a row in df1 matches any row in df2 on the combination of order_id and shop, then this row should be dropped from df1. If this row doesn't match any row in df2 on order_id and shop, it should be kept.
Example
df2 is such that,
order_id shop
0 12345 'NL'
1 45678 'FR'
2 12345 'DE'
3 34567 'NL'
Now if df1 such that,
order_id shop
0 12345 'NL'
1 45678 'FR'
then df1 should return empty.
But if df1 such that,
order_id shop
0 12345 'NL'
1 99999 'FR'
2 12345 'UK'
then df1 should return,
order_id shop
0 99999 'FR'
1 12345 'UK'
Code
I created a monstrous line which then didn't really work...
So far, I have,
result_df = df1[(~df1['order_id'].astype(str).isin(df2['order_id'].astype(str)))]
How do I solve this?