title: How can I merge two dataframes not by values but by ranges of values?
body: <p>Dataframe A: </p>
  
  <pre><code>pd.Dataframe({
      'price': [50, 150, 250], 
      'group':[2, 5, 10]
  })
  </code></pre>
  
  <p>Dataframe B: </p>
  
  <pre><code>pd.Dataframe({
      'low_price': [0, 100, 200], 
      'high_price': [99, 199, 299],
      'low_group':[0, 4, 8],
      'high_group':[3, 6, 12],
      'something':['A', 'B', 'C']
  })
  </code></pre>
  
  <p>How can I merge these dataframes on a condition like:<br>
  - Dataframe A's price is <strong>between</strong> Dataframe B's low and high prices.<br>
  AND<br>
  - Dataframe A's group is <strong>between</strong> Dataframe B's low and high groups.</p>
  
  <p>Is there a way to do this <strong>without iterating</strong> through rows and checking one by one? I already did it like that and it costs O(n^2), not scalable.</p>
  
  <hr>
  
  <p><strong>EDIT</strong>:</p>
  
  <p>PS1: Every row in A has 0 or 1 match in B. I'm looking for an "inner" merge.</p>
  
  <p>PS2: A has millions of records, B has hundreds.</p>