Pandas analogue of the SQL statement "NOT IN"
Surprisingly, I cannot find an analogue of the "NOT IN" SQL statement in pandas DataFrames.
A = pd.DataFrame({'a':[6,8,3,9,5],
'b':['II','I','I','III','II']})
B = pd.DataFrame({'c':[1,2,3,4,5]})
I want all lines from A
that A
do not contain values from B
c
. Something like:
A = A[ A.a not in B.c]
+3
source to share