title: how to calculate percentages of a multilevel index groupby?
body: <p>Suppose you're given the following data:</p>
  <pre><code>records = [
      {'group': 'A', 'name': 'Chris', 'is_male': True, 'smoker': False}, 
      {'group': 'A', 'name': 'Bob', 'is_male': True, 'smoker': True}, 
      {'group': 'A', 'name': 'Dana', 'is_male': False, 'smoker': False}, 
      {'group': 'B', 'name': 'Alice', 'is_male': False, 'smoker': True}, 
      {'group': 'B', 'name': 'Michael', 'is_male': True, 'smoker': True}, 
      {'group': 'B', 'name': 'Ron', 'is_male': True, 'smoker': True}, 
      {'group': 'C', 'name': 'Rihanna', 'is_male': False, 'smoker': True}, 
      {'group': 'C', 'name': 'Madonna', 'is_male': False, 'smoker': True}, 
      {'group': 'C', 'name': 'Cher', 'is_male': False, 'smoker': False}, 
      {'group': 'C', 'name': 'John', 'is_male': True, 'smoker': True}, 
      
  ]
  
  data = pd.DataFrame.from_dict(records)
  </code></pre>
  <p>If we do this:</p>
  <pre><code>data.groupby(['group', 'is_male', 'smoker']).count().reset_index()
  </code></pre>
  <p>we get:</p>
  <pre><code>group   is_male smoker  name
  A   False   False   1
  A   True    False   1
  A   True    True    1
  B   False   True    1
  B   True    True    2
  C   False   False   1
  C   False   True    2
  C   True    True    1
  </code></pre>
  <p>What I'd like to do is to get the same data, but in percentages, <strong>by the size of the <code>group</code></strong></p>
  <p>For example, in group <code>B</code> we'll get <code>1/3</code> and <code>2/3</code></p>
  <p>How can I do that?</p>