I have 2 Pandas dataframe and I want to find the length of the intersection of 2 columns in order. For example:
df1 =
a b
a1 b1
a2 b2
a3 b3
df2 =
a b
a1 b1
a4 b4
a2 b4
Answer: 1 only 1 pair is in common (a1. b1)
For 1 column, I can simply write:
set(df1.a).intersection(set(df2.a))
How to do this for 2 columns without merging the 2 data frames and is it possible?
EDIT: I want it without merging