title: Find the closest values in a sorted pandas dataframe to values in a list
body: <p>I have seen :</p>
  <p><a href="https://stackoverflow.com/questions/30112202/how-do-i-find-the-closest-values-in-a-pandas-series-to-an-input-number">How do I find the closest values in a Pandas series to an input number?</a></p>
  <p>I have a pandas DataFrame like this :</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">idx</th>
  <th style="text-align: center;">col1</th>
  <th style="text-align: right;">col2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">1</td>
  <td style="text-align: center;">2</td>
  <td style="text-align: right;">56</td>
  </tr>
  <tr>
  <td style="text-align: left;">2</td>
  <td style="text-align: center;">3</td>
  <td style="text-align: right;">22</td>
  </tr>
  <tr>
  <td style="text-align: left;">3</td>
  <td style="text-align: center;">6</td>
  <td style="text-align: right;">12</td>
  </tr>
  <tr>
  <td style="text-align: left;">4</td>
  <td style="text-align: center;">7</td>
  <td style="text-align: right;">7</td>
  </tr>
  <tr>
  <td style="text-align: left;">5</td>
  <td style="text-align: center;">7.5</td>
  <td style="text-align: right;">6</td>
  </tr>
  <tr>
  <td style="text-align: left;">6</td>
  <td style="text-align: center;">9</td>
  <td style="text-align: right;">9</td>
  </tr>
  <tr>
  <td style="text-align: left;">7</td>
  <td style="text-align: center;">10.1</td>
  <td style="text-align: right;">11</td>
  </tr>
  <tr>
  <td style="text-align: left;">8</td>
  <td style="text-align: center;">11</td>
  <td style="text-align: right;">23</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>and an input list like this :</p>
  <p>[ 4, 7.6, 10]</p>
  <p>I want to keep the same number of rows as the list length, where the elements in df['col1'] are the closest to the elements in the list such that y output DataFrame is :</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th style="text-align: left;">idx</th>
  <th style="text-align: center;">col1</th>
  <th style="text-align: right;">col2</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td style="text-align: left;">2</td>
  <td style="text-align: center;">3</td>
  <td style="text-align: right;">22</td>
  </tr>
  <tr>
  <td style="text-align: left;">5</td>
  <td style="text-align: center;">7.5</td>
  <td style="text-align: right;">6</td>
  </tr>
  <tr>
  <td style="text-align: left;">7</td>
  <td style="text-align: center;">10.1</td>
  <td style="text-align: right;">11</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>What is an efficient solution when dataframe and list get big?</p>