I have a dataframe df
as:
node date_ A1 A2
bkt B1 B2 B1 B2
0 1/1/2015 0.9 1 2 1
1 1/2/2015 0.7 0.6 5 6
2 1/3/2015 0.9 1 9 23
df.columns
MultiIndex([( 'date_', ''),
( 'A1', 'B1'),
( 'A1', 'B2'),
( 'A2', 'B1'),
( 'A2', 'B2'),
( 'Month', '')],
names=['node', 'bkt'])
I have another dataframe df2
as:
bkt B1 B2
0 1/1/2015 2 1
1 1/2/2015 2 2
2 1/3/2015 3 1
Is it possible to multiply df
with df1
so that corresponding columns B1 and B2 get multiplied to give the following results:
node date_ A1 A2
bkt B1 B2 B1 B2
0 1/1/2015 1.8 1 4 1
1 1/2/2015 1.4 1.2 10 12
2 1/3/2015 2.7 1 27 23