title: Remove duplication based on date conditions
body: <p>I had a dataframe like below, and I would like to remove duplications based on certain criteria. 
  1) If the startdate is greater than Month, it will be removed. 
  2) If the startdate is less than Month, keep the latest record.</p>
  
  <pre><code>&gt;       COMP    Month       Startdate   bundle            result
  &gt; 0     TD3M    2018-03-01  2015-08-28  01_Essential      keep    
  &gt; 1     TD3M    2018-03-01  2018-07-17  04_Complete       remove
  &gt; 2     TD3M    2018-04-01  2015-08-28  01_Essential      keep
  &gt; 3     TD3M    2018-04-01  2018-07-17  04_Complete       remove
  &gt; 4     TD3M    2018-05-01  2015-08-28  01_Essential      keep
  &gt; 5     TD3M    2018-05-01  2018-07-17  04_Complete       remove
  &gt; 6     TD3M    2018-06-01  2015-08-28  01_Essential      keep
  &gt; 7     TD3M    2018-06-01  2018-07-17  04_Complete       remove
  &gt; 8     TD3M    2018-08-01  2015-08-28  01_Essential      remove
  &gt; 9     TD3M    2018-08-01  2018-07-17  04_Complete       keep
  &gt; 10    TD3M    2018-09-01  2015-08-28  01_Essential      remove
  &gt; 11    TD3M    2018-09-01  2018-07-17  04_Complete       keep
  </code></pre>
  
  <p>The expected output would be:</p>
  
  <pre><code>&gt;       COMP    Month       Startdate   bundle            
  &gt; 0     TD3M    2018-03-01  2015-08-28  01_Essential      
  &gt; 2     TD3M    2018-04-01  2015-08-28  01_Essential     
  &gt; 4     TD3M    2018-05-01  2015-08-28  01_Essential     
  &gt; 6     TD3M    2018-06-01  2015-08-28  01_Essential     
  &gt; 9     TD3M    2018-08-01  2018-07-17  04_Complete  
  &gt; 11    TD3M    2018-09-01  2018-07-17  04_Complete          
  </code></pre>