here is the dataframe I’m currently working on : What I’d like to calculate is the average of the variable “avg_lag” weighted by “tot_SKU” in each product_basket for both SMB and CORP groups. This means that, taking CORP as an example, I want to calculate something as: (585,134 * 46.09 + 147,398 * 104.55 + … + 1,112,941 * 75.73)
Tag: weighted-average
Calculate adjusted cost base using Python pandas ( Portfolio Analysis of Stocks Buy/Sell)
I am trying to do a portfolio analysis of my trading and trying to calculate the adjusted cost base price. I have tried almost everything but nothing seems to work. I am able to calculate the adjusted quantity but not able to get the adjusted buy price Could anyone please help? Here is the Sample trade log raw data I