I have 2 dataframes:
d1={'A':[1,3,5,7,8,4,6],'B':[6,4,3,8,1,7,4], 'C':[2,5,8,9,8,4,7]}df1=pd.DataFrame(data=d1)d2={'a':[2,8,6,5,7],'b':[6,4,9,3,2]}df2=pd.DataFrame(data=d2)
Now, I would like to see which "a" and "b" values of df2 are the same as "A" and "B" values of df1. This is true for the third row of df1 and fourth row of df2 [5,3], thus the result will be a new column in df2 saying True.The dataframes have different length and also different number of columns. I know there is function "isin", I can apply it when I search for pattern in one column but not in two columns at once. I also found function "merge" with indicator=True but only understand how to apply it when the dataframes have the same number of columns.I would be very grateful for a help in this situation.