I am looking for the best way to aggregate values based on a particular partition , an equivalent of
SUM(TotalCost) OVER(PARTITION BY ShopName) Earnings ( SQL server)
I am able to do this by the following steps in Pandas , but looking for a native approach which I am sure should exist
TempDF= DF.groupby(by=['ShopName'])['TotalCost'].sum()
TempDF= TempDF.reset_index()
NewDF=pd.merge(DF , TempDF, how='inner', on='ShopName')
Thanks a lot for reading through !