I have two data frames (A and B)
A:
column 1, column 2, column 3
0.1 0.5 0.7
B:
row 1 5
row 2 6
row 3 7
how do I perform multiplication to get like
(0.1)*5, (0.5)* 6, and (0.7)*7?
In other words, how do I multiply the value in the first row of B with the value in the first column of A, the second row of B with the value in the second column of B, and etc?
you want to multiply their values without respect to whether they are rows or columns.
pd.Series(A.values.ravel() * B.values.ravel())
0 0.5
1 3.0
2 4.9
dtype: float64
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With