title: Select rows per groups and with time conditions
body: <pre><code>           A          B   C
  0 2002-01-16 2002-02-28  HH
  1 2002-01-16 2002-01-30  DX
  2 2002-01-16 2002-02-28  TY
  3 2002-01-16 2002-01-30  FY
  4 2002-04-28 2002-04-30  PE
  5 2002-04-28 2002-05-25  CO
  6 2002-04-28 2002-04-30  OL
  7 2002-04-28 2002-05-25  DS
  </code></pre>
  
  <p>I want to select , per each <code>A</code> group, rows whose <code>A</code> date are:</p>
  
  <ul>
  <li>Closest in time to <code>B</code> date.</li>
  <li>Greater than two days to <code>B</code> date.</li>
  </ul>
  
  <p>Output should be:</p>
  
  <pre><code>           A          B   C
  1 2002-01-16 2002-01-30  DX
  3 2002-01-16 2002-01-30  FY
  5 2002-04-28 2002-05-25  CO
  7 2002-04-28 2002-05-25  DS
  </code></pre>
  
  <p>I´ve tried:</p>
  
  <pre><code>df['Diff'] = (df['B'] - df['A']).abs()
  df.loc[df['Diff'] == df['A'].map(df.groupby('A')['Diff'].min())]
  </code></pre>