title: Filter rows in dataframe under group percentile
body: <p>I have a dataframe containing various groups. For each group, I would like to filter out half of the rows, by their values - <strong>I want to filter out the half of the rows with the lowest value column</strong>. For example this is the base DF:</p>
  <pre><code>id  | groupId   | value 
  1   | A         | 5
  2   | A         | 10
  3   | A         | 15
  4   | A         | 9
  5   | B         | 1
  6   | B         | 2
  7   | B         | 3
  8   | B         | 4
  </code></pre>
  <p><em>And after the filtering:</em></p>
  <pre><code>    id  | groupId   | value 
      2   | A         | 10
      3   | A         | 15
      7   | B         | 3
      8   | B         | 4
  </code></pre>
  <p>You can see that the <strong>bottom 50% of each group</strong>, by their value, is filtered out.</p>
  <p>Notice that 50% is a magic number and needs to be configurable.</p>
  <p>Any idea how can I achieve this? I've tried groping by groupId and then get the mean but I couldn't figure it out.<br />
  Thanks!</p>