title: Python pandas: how to select the rows when sign changes and have miminum of the values?
body: <p>I was trying to find where the function crosses the line x=0. I utilized the fact that when the function crosses x-axis, its sign changes.</p>
  
  <p>Now, I have a dataframe like this, I want to find the TWO rows that are closest to zeros, given that function crosses the x-axis at two points.</p>
  
  <pre><code>     A     value
  0  105  0.662932
  1  105  0.662932
  2  107  0.052653 # sign changes here when A is 107
  3  108 -0.228060 # among these two A 107 is closer to zero
  4  110 -0.740819
  5  112 -1.188906
  6  142 -0.228060 # sign changes here when A is 142
  7  143  0.052654 # among these two, A 143 is closer to zero
  8  144  0.349638
  </code></pre>
  
  <p>Required output:</p>
  
  <pre><code>     A     value
  2  107  0.052653 
  7  143  0.052654 
  </code></pre>