title: Pandas top n values in each group
body: <p>I have a dataframe like</p>
  
  <pre><code>item      date       hour     value
    a         4         12       123
    a         6         11        54
    b         1          7       146
    c         8          1        97
    a         9          5        10
    c         4          5       114
    b         1          7       200
  ...       ...        ...       ...
  </code></pre>
  
  <p>and I want to keep the top 10 <code>item</code> by <code>value</code> (discard the rest is ok), regardless any other column. They are not sorted.</p>
  
  <p>Following my input example, and as I didn't write enough to get 10 from every item, the expected output would be something like this if I want the top 1:</p>
  
  <pre><code>item      date       hour     value
    a         4         12       123
    c         4          5       114
    b         1          7       200
  ...       ...        ...       ...
  </code></pre>
  
  <p>I've seen this <a href="https://stackoverflow.com/questions/33168397/pandas-get-top-10-values-after-grouping">answer</a> but I'm not sure how to tell pandas to take <code>value</code> for the calculation.</p>