Q:

How to merge 2 dataframe base on a third dataframe containing multiindex

I have 2 dataframe and i want to merge them. my join keys are index and they are third dataframe.
the two dataframe :
df1 = pd.DataFrame({'A' : [1,2,3] })
df2 = pd.DataFrame({'B' : ['A','B','C']})

the dataframe containing index list:
df3 = pd.DataFrame({'C' :[1], 'D' :[2]})
df3 = df3.set_index(['C','D'])

desired output :
    A   B
0   2   C

A:

With tuples in a list:
Setup
import pandas as pd

df1 = pd.DataFrame({'A' : [1,2,3] })
df2 = pd.DataFrame({'B' : ['A','B','C']})
t = [(1,2), (1,0)]

Make df3, with the correct column names:
df3 = pd.DataFrame(t, columns=list(df1.columns)+list(df2.columns))
#   A  B
#0  1  2
#1  1  0

Then you can use lookup + pivot to get the correct value from each frame, and return to the original shape.
df3 = df3.stack().reset_index()
df3['vals'] = pd.concat([df1, df2], 1).lookup(df3[0], df3.level_1)
df3 = df3.pivot(index='level_0', columns='level_1', values='vals').rename_axis(None, 1).rename_axis(None, 0)

#   A  B
#0  2  C
#1  2  A

