I have 2 pandas dataframes df1 & df2 with common columns/keys (x,y).
I want to merge do a "(df1 & not df2)" kind of merge on keys (x,y), meaning I want my code to return a dataframe containing rows with (x,y) only in df1 & not in df2.
SAS has an equivalent functionality
data final;
merge df1(in=a) df2(in=b);
by x y;
if a & not b;
run;
Who to replicate the same functionality in pandas elegantly?
It would have been great if we can specify how="left-right" in merge().
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…