I am trying to find the percentage contribution made by each date group. Given below is how my data looks like.
Expecting to find contribution of each product for a given
Use groupby().transform():
groupby().transform()
df['quantity'] / df.groupby('date')['quantity'].transform('sum')