I have 4 columns of data in a dataframe, where most of the time all 4 columns have data.
In some cases, there are empty cells in the dataframe.
How can I multiply the first 3 occurring values together regardless of their position? I have tried things like df.loc to no avail.
Data below.
{Input Dataframe}
A B C D
0 (empty) 58 44 62
1 42 34 (empty) 46
2 85 (empty) 81 91
3 54 43 42 56
{Output Dataframe}
0 158224
1 65688
2 626535
3 97524
After multiplying them together, I would like to add a weighting to the scores as well. e.g. first value is 50% of the final score, second value is 35% of final score, third value is 15% of final score. This is would be a sum of the products multiplied by the weighting factor.
Math for row 0 would result in the following: 58x0.5 + 44x0.35 + 62x0.15 = 53.7
{Weighted Sum Result}
0 53.7
1 39.8
2 84.5
3 48.35
42 x 34 x 46 = 65688no?