I have 2 df as Main df
main_df=pd.DataFrame(np.arange(3,9).reshape(-1,2), columns = list('AB'))
A B
0 3 4
1 5 6
2 7 8
weights df
w_df=pd.DataFrame(np.arange(1,5).reshape(-1,2), columns = ['wA','wB'])/10
wA wB
0 0.1 0.2
1 0.3 0.4
I need to multiply specific row from weights df into all columns of main df and put the summation into a column in main df so output should be like in case of using 1st row from weights df
Prod Sum of 1st row in main = 0.1 * 3 + 0.2 *4 = 1.1
Prod Sum of 2nd row in main = 0.1 * 5 + 0.2 *6 = 1.7
Prod Sum of 3rd row in main = 0.1 * 7 + 0.2 *8 = 2.3
i.e. output of main df should be like (in case of using 1st row from weights df)
A B prod_sum
0 3 4 1.1
1 5 6 1.7
2 7 8 2.3