title: How can I check if the range of one dataframe is within the range of another dataframe
body: <p>I have 2 dataframes and I want to check if the Start, End ranges in DF1 are within the Start, End ranges in DF2 and for the ones that are true I want to print the ID and the region. I want to compare each row of DF1 to each row of DF2.</p>
  <p>These are my dataframes:</p>
  <pre><code>DF1 = pd.DataFrame ({'Start':[500, 850, 1000],
                      'End':[700, 950, 1200],
                      'Region':[&quot;A&quot;, &quot;B&quot;, &quot;C&quot;]})
  
  DF2 = pd.DataFrame ({'Start':[200, 800, 1100],
                      'End':[750, 950, 1250],
                      'ID':[1, 2, 3]})
  </code></pre>
  <p>DF1</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Start</th>
  <th>End</th>
  <th>Region</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>500</td>
  <td>700</td>
  <td>A</td>
  </tr>
  <tr>
  <td>850</td>
  <td>950</td>
  <td>B</td>
  </tr>
  <tr>
  <td>1000</td>
  <td>1200</td>
  <td>C</td>
  </tr>
  <tr>
  <td>1100</td>
  <td>1500</td>
  <td>D</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>DF2</p>
  <div class="s-table-container">
  <table class="s-table">
  <thead>
  <tr>
  <th>Start</th>
  <th>End</th>
  <th>ID</th>
  </tr>
  </thead>
  <tbody>
  <tr>
  <td>200</td>
  <td>750</td>
  <td>1</td>
  </tr>
  <tr>
  <td>800</td>
  <td>950</td>
  <td>2</td>
  </tr>
  <tr>
  <td>1100</td>
  <td>1250</td>
  <td>3</td>
  </tr>
  </tbody>
  </table>
  </div>
  <p>I assume that I have to write a for loop to iterate through all the rows. However, I am a beginner and I am having a hard time setting it up correctly.</p>
  <p>This is the code I have tried so far.</p>
  <pre><code>for Start, End in DF1:
      if Start&gt;=DF2[&quot;Start&quot;] and End&lt;=DF2[&quot;End&quot;]:
        print (DF1[&quot;Region&quot;], DF2[&quot;ID&quot;])
  </code></pre>
  <p>However, I am getting this error: ValueError: too many values to unpack (expected 2)</p>
  <p>Any advice on how to solve this would be greatly appreciated.</p>