title: Pandas Groupy take only the first N Groups
body: <p>I have some DataFrame which I want to group by the ID, e. g.:</p>
  
  <pre><code>import pandas as pd
  df = pd.DataFrame({'item_id': ['a', 'a', 'b', 'b', 'b', 'c', 'd'], 'user_id': [1,2,1,1,3,1,5]})
  print df
  </code></pre>
  
  <p>Which generates:</p>
  
  <pre><code>  item_id  user_id
  0       a        1
  1       a        2
  2       b        1
  3       b        1
  4       b        3
  5       c        1
  6       d        5
  
  [7 rows x 2 columns]
  </code></pre>
  
  <p>I can easily group by the id:</p>
  
  <pre><code>grouped = df.groupby("item_id")
  </code></pre>
  
  <p>But how can I return only the first N group-by objects? E. g. I want only the first 3 unique item_ids.</p>