title: Pandas: Remove rows per group based on a condition
body: <p>Let's assume that I have the following data-frame:</p>
  
  <pre><code>df = pd.DataFrame({"id": [1, 1, 1, 2, 2, 2], "date": [pd.Timestamp(2016, 7, 29), pd.Timestamp(2017, 8, 22), pd.Timestamp(2017, 10, 9), pd.Timestamp(2018, 1, 9), pd.Timestamp(2018, 3, 31), pd.Timestamp(2018, 7, 5)], "other_col": [11.1, 77.7, 22.2, 33.3, 44.4, 88.8]})
  </code></pre>
  
  <p>What I want to achieve is delete the last <code>N</code> rows for each group where the <code>data-frame is grouped by id</code> such that <code>N</code> is: The number of rows that have a <code>date</code> that is within 3 months of the <code>date</code> of the last row (This will delete the last row). The resulting data-frame should be:</p>
  
  <pre><code>r_df = pd.DataFrame({"id": [1, 2, 2], "date": [pd.Timestamp(2016, 7, 29), pd.Timestamp(2018, 1, 9), pd.Timestamp(2018, 3, 31)], "other_col": [11.1, 33.3, 44.4]})
  </code></pre>
  
  <ul>
  <li>The rows of the data-frame will always be ordered </li>
  <li>The last row should also be removed because by default its date is within the "delete" range of dates for each group.</li>
  </ul>