title: Selecting rows in groups with conditions
body: <pre><code>        A     B     C
  0    blue  14.5  14.0
  1    blue  14.0  14.0
  2    blue  13.5  14.0
  3    blue  12.0  14.0
  4    blue  10.5  14.0
  5   green  20.0  19.0
  6   green  19.0  19.0
  7   green  18.5  19.0
  8   green  18.0  19.0
  9   green  17.5  19.0
  10  green  16.0  19.0
  </code></pre>
  
  <p>I want to create a new <code>df1</code> with next conditions, per each <em>A group</em> ("blue" and "green"):</p>
  
  <ul>
  <li>Select the rows where <em>B = C</em> and rows where <em>B = C-1</em></li>
  <li><p>If it doesn´t exist any <em>B value</em> in the group that satisfy the condition <em>(B = C-1)</em>, select the next row further down that would correspond. For instance, in "blue group" <em>B = C - 1</em> would be <em>14.0 - 1 = 13.0</em> . As it doesn´t exist any <code>13.0</code> "blue group", select the next row further down that exists in <code>df</code>, that is:</p>
  
  <p><code>3    blue  12.0  14.0</code></p></li>
  </ul>
  
  <p>df1 should be:</p>
  
  <pre><code>       A     B     C
  1   blue  14.0  14.0
  3   blue  12.0  14.0
  6  green  19.0  19.0
  8  green  18.0  19.0
  </code></pre>
  
  <p>I´ve tried:</p>
  
  <pre><code>df1 = df[(df["B"] == df["C"]) | (df["B"] == df["C"]-1)]
  </code></pre>