Apologies if this is a simple question.
I have two dataframes each with the same columns. I need to multiply each row in the second dataframe by the only row in the first.
Eventually there will be more columns of different ages so I do not want to just multiply by a scalar.
I have used df.multiply() and continue to get NaN for all values presumably because the two df are not matched in length.
Is there a way to multiply each row in one dataframe by a singular row in another?
age 51200000.0 70000000.0
SFH
0 0.75 0.25
.
age 51200000.0 70000000.0
Lambda
91.0 0.000000e+00 0.000000e+00
94.0 0.000000e+00 0.000000e+00
96.0 0.000000e+00 0.000000e+00
98.0 0.000000e+00 0.000000e+00
100.0 0.000000e+00 0.000000e+00
102.0 0.000000e+00 0.000000e+00
... ... ...
1600000.0 1.127428e+22 8.677663e+21
You can use
mul
by first row ofdf1
selected byiloc
:Sample: