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