How I can find the complement of a dataframe with respect of another dataframe? In pandas it can be done by the following code:
df = df1.merge(df2, how = 'outer' ,indicator=True).loc[lambda x : x['_merge']=='right_only']
Example:
+---------+----+
| City|Temp|
+---------+----+
| New York| 59|
| Chicago| 29|
| Tokyo| 73|
| Paris| 56|
|New Delhi| 48|
+---------+----+
+---------+----+
| City|Temp|
+---------+----+
| London| 55|
| New York| 55|
| Tokyo| 73|
|New Delhi| 85|
| Paris| 56|
+---------+----+
Result:
+---------+----+----------+
| City|Temp|_merge |
+---------+----+----------+
| London| 55|right_only|
|New Delhi| 85|right_only|
| New York| 55|right_only|
+---------+----+----------+
