title: How do i keep the number of rows based on the quantity of other column?
body: <p>I have been stuck figuring this out for a couple of days.</p>
  
  <p>For example I have a dataframe below:</p>
  
  <pre><code>+---------+---------+
  | ColumnA | ColumnB |
  +---------+---------+
  | PartA   |       4 |
  | PartA   |       4 |
  | PartA   |       4 |
  | PartA   |       4 |
  | PartA   |       4 |
  | PartA   |       4 |
  | PartB   |       3 |
  | PartB   |       3 |
  | PartB   |       3 |
  | PartB   |       3 |
  | PartC   |       2 |
  | PartC   |       2 |
  | PartC   |       2 |
  | PartC   |       2 |
  +---------+---------+
  </code></pre>
  
  <p>How do I turn the above dataframe into this:</p>
  
  <pre><code>+---------+---------+
  | ColumnA | ColumnB |
  +---------+---------+
  | PartA   |       4 |
  | PartA   |       4 |
  | PartA   |       4 |
  | PartA   |       4 |
  | PartB   |       3 |
  | PartB   |       3 |
  | PartB   |       3 |
  | PartC   |       2 |
  | PartC   |       2 |
  +---------+---------+
  </code></pre>
  
  <p>As you can see I want to keep the number of rows based on the number on ColumnB</p>
  
  <p>The closest solution that I found is using <code>df.groupby('ColumnA').tail(3)</code>
  But i want the value in the tail to constantly changing based on the ColumnB.</p>
  
  <p>Any help would be greatly appreciated!!! Thanks you!</p>