I have a dataframe that looks something like this (very simplified):
Fund Weight Value1 Value2
A 0.3 83 100
A 0.2 62 150
A 0.4 70 70
A 0.1 80 180
B 0.15 87 120
B 0.25 91 80
B 0.5 76 170
B 0.2 12 110
What I am trying to do is to calculate the cross-product between the columns Weight and other columns for each Fund.
Eventually, I want to have a data frame that looks something like this:
Fund Value1 Value2
A 73.3 106
B 76.2 145
So far, I have only managed to calculate the cross-product with a separate data frame for each Fund which is not a viable option as the data frame is too big.
Any help would be very appreciated.
or
or even: