midx1 = pd.MultiIndex.from_product([['X', 'Y'], [1, 2, 3]])
midx2 = pd.MultiIndex.from_product([['X', 'Y'], [1, 2, 3], ['a', 'b', 'c']])
A = pd.DataFrame(np.random.randint(0, 2, (6, 4)), midx1, list('ABCD'))
B = pd.DataFrame(np.random.randint(2, 4, (18, 4)), midx2, list('ABCD'))
Pandas multiply dataframes with multiindex and overlapping index levels