title: create new column by dividing groupby sum in pandas
body: <p>I have data frame as shown below</p>
  <p>df:</p>
  <pre><code>product_x  year     total_price      total_sale
  A          2016     50               200           
  B          2016     200              100           
  A          2017     250              250           
  B          2017     1000             300           
  A          2018     100              50           
  B          2018     900              600
  </code></pre>
  <p>from the above I would like calculate the product_x wise sales percentage as shown below.</p>
  <p>Expected output:</p>
  <pre><code>product_x  year     total_price      total_sale     product_sale_perc
  A          2016     50               200            40
  B          2016     200              100            10
  A          2017     250              250            50 
  B          2017     1000             300            30    
  A          2018     100              50             10     
  B          2018     900              600            60
  </code></pre>
  <p>I tried below</p>
  <pre><code>df['product_sale_perc'] = df['total_sale']/df.groupby('product_x')['total_sale'].sum()
  </code></pre>