from itertools import cycle
A.columns = pd.MultiIndex.from_tuples(zip(cycle('A'), A.columns))
A
B.columns = pd.MultiIndex.from_tuples(zip(cycle('B'), B.columns))
A.join(B)
Merge Two DataFrames With Hierarchical Columns