title: How do I find the closest values in a Pandas series to an input number?
body: <p>I have seen:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/24096373/how-do-i-find-the-closest-value-to-a-given-number-in-an-array">how do I find the closest value to a given number in an array?</a></li>
  <li><a href="https://stackoverflow.com/questions/4193708/how-do-i-find-the-closest-array-element-to-an-arbitrary-non-member-number">How do I find the closest array element to an arbitrary (non-member) number?</a>.</li>
  </ul>
  
  <p>These relate to vanilla python and not pandas.</p>
  
  <p>If I have the series:</p>
  
  <pre><code>ix   num  
  0    1
  1    6
  2    4
  3    5
  4    2
  </code></pre>
  
  <p>And I input 3, <strong>how can I (efficiently) find?</strong></p>
  
  <ol>
  <li>The index of 3 if it is found in the series</li>
  <li>The index of the value below and above 3 if it is not found in the series.</li>
  </ol>
  
  <p>Ie. With the above series {1,6,4,5,2}, and input 3, I should get values (4,2) with indexes (2,4).</p>