title: Strange behaviour in pandas.groupby
body: <p>I feel like this is very obvious mistake on my part, but for some reason, the solution is escaping me right now.</p>
  
  <p>So, first, create the following dataframe</p>
  
  <pre><code>import pandas as pd
  A = {'device': 1, 'component': 100, 'value': 10}
  B = {'device': 1, 'component': 100, 'value': 20}
  C = {'device': 1, 'component': 101, 'value': 20}
  D = {'device': 2, 'component': 100, 'value': 30}
  E = {'device': 2, 'component': 100, 'value': 31}
  F = pd.DataFrame([A, B, C, D, E])
  </code></pre>
  
  <p>Now, I want to apply a method to unique groups of "device" and "component". For simplicity, assume I simply want to get the shape of the dataframe</p>
  
  <pre><code>def simple(df):
    print(df.shape)
  </code></pre>
  
  <p>Now, apply it to per grouping</p>
  
  <pre><code>F.groupby(['device', 'component']).apply(simple)
  </code></pre>
  
  <p>The output is </p>
  
  <pre><code>(2, 3)
  (2, 3)
  (1, 3)
  (2, 3)
  </code></pre>
  
  <p>Which is what you would expect, but let's change this now</p>
  
  <pre><code>A = {'device': 1, 'component': 100, 'value': 10}
  B = {'device': 1, 'component': 100, 'value': 20}
  C = {'device': 1, 'component': 100, 'value': 20}
  F_new = pd.DataFrame([A, B, C])
  F_new.groupby(['device', 'component']).apply(simple)
  </code></pre>
  
  <p>This gives</p>
  
  <pre><code>(3, 3)
  (3, 3)
  </code></pre>
  
  <p>Why does it not give me (3, 3) <strong>once and only once</strong>?</p>