title: Finding percentage of profitable investments with pandas groupby functionality
body: <p>I have a pandas DataFrame like this; it shows a history of stock investing. In the Profit column, 1 means profitable and 0 means loss-making.</p>
  
  <pre><code>Stock  Year   Profit  Count
   AAPL  2012    0       23
   AAPL  2012    1       19
   AAPL  2013    0       20
   AAPL  2013    1       10
  GOOG   2012    0       26
  GOOG   2012    1       20
  GOOG   2013    0       23
  GOOG   2013    1       11
  </code></pre>
  
  <p>I have to find out the percentage of profitable investments: </p>
  
  <pre><code>Stock  Year   Profit  CountPercent
   AAPL  2012    1       38.77
   AAPL  2013    1       33.33
  GOOG   2012    1       43.47
  GOOG   2013    1       32.35
  </code></pre>
  
  <p>I tried using the method in <a href="https://stackoverflow.com/questions/23377108/pandas-percentage-of-total-with-groupby">this post</a>
   but it shows <code>'TypeError: Join on level between two MultiIndex objects is ambiguous'</code>.</p>