title: Getting percentage for each column after groupby
body: <p>I have a pandas dataframe with two columns <code>A</code> and <code>B</code>. The column <code>B</code> contains three categories <code>X</code>, <code>Y</code>, 'Z'. I need to check the how much percentage is a particular value for each group in A. Here is how the dataframe looks like:</p>
  
  <pre><code>  A   B
    AA  X 
    BB  Y
    CC  Z
    AA  Y
    AA  Y
    BB  Z 
    ..  ..
  </code></pre>
  
  <p>Now I want to plot a stacked plot but it should be a percentage based stacked plot and not just count based for each category in <code>B</code> corresponding to a group in <code>A</code>. Here is what I did so far:</p>
  
  <p><code>df.groupby(['A'])['B'].value_counts().unstack()</code> which gives me this</p>
  
  <pre><code>B   X    Y      Z
  A           
  AA  65   666    5
  BB  123  475    6
  CC  267  1337   40
  </code></pre>
  
  <p>Now I want to divide each column by the sum of it's corresponding row  like for first row <code>(65/(65+666+5), 666/(65+666+5), 5/(65+666+5),)</code>and plot the results as stacked bar plot.
  Can someone please help?</p>