title: perform deduction for each group based on the rows value in the column
body: <p>I have below dataframe:</p>
  
  <pre><code>import pandas as pd
  df = pd.DataFrame({'ID':[1,1,1,2,2,2,3,3,4,4,4],
                    'money':[300,300,300,400,400,400,500,500,600,600,600],
                    'type':['a','b','c','a','b','c','b','c','a','b','c'],
                    'total':[30,10,20,10,10,30,40,40,10,20,30]})
  df
  </code></pre>
  
  <p>I wish to find the percentage for each row in the column ['total']. Example, </p>
  
  <pre><code>['ID'] = 1
  </code></pre>
  
  <p>we have </p>
  
  <pre><code>['total'] = [30,10,20]
  </code></pre>
  
  <p>I want it to be in the form of such:</p>
  
  <pre><code>30+10+20 = 60
  
  30/60 = 0.5
  10/60 = 0.167
  20/60  = 0.33
  </code></pre>
  
  <p>so that I will get a table as below </p>
  
  <pre><code>ID  money   type    total   percentage
  0   1   300 a   30  0.500
  1   1   300 b   10  0.167
  2   1   300 c   20  0.333
  3   2   400 a   10  0.200
  4   2   400 b   10  0.200
  5   2   400 c   30  0.600
  6   3   500 b   40  0.500
  7   3   500 c   40  0.500
  8   4   600 a   10  0.167
  9   4   600 b   20  0.333
  10  4   600 c   30  0.500
  </code></pre>