title: Merge two pandas dataframes based on depth range
body: <p>I would like to merge two dataframe on columns Id and top_depth and bottom_depth.<br>
  I would like the take each record from the left df and, if available, assign a record from the right df if 'depth' falls between 'top_depth' and 'bottom_depth'. </p>
  
  <p>Here is an exemple of the dataframes:</p>
  
  <pre><code>df1 = pd.DataFrame(np.array([
       ['a', 27, 29, 10],
       ['a', 29, 30, 2.5],
       ['a', 30, 32.5, 56],
       ['a', 32.5, 36, 18],
       ['a', 36, 39, 5],
       ['b', 0, 3, 0.5],
       ['b', 3, 6, 1.5],
       ['b', 6, 9, 2.5]]),
       columns=['name', 'top_depth', 'bottom_depth', 'attr1'])
  
  df2 = pd.DataFrame(np.array([
       ['a', 0, 25, 'alpha'],
       ['a', 25, 28, 'beta'],
       ['a', 28, 39, 'gamma'],
       ['b', 0, 6, 'alpha'],
       ['b', 6, 9, 'beta'],
       ['b', 9, 18, 'phi'],
       ['b', 18, 25, 'teta']]),
       columns=['name', 'top_depth', 'bottom_depth', 'attr2'])
  </code></pre>
  
  <p>Then merge to get this:</p>
  
  <pre><code>&gt;&gt;&gt; df3 
     name top_depth bottom_depth attr1   attr2
  0     a         0           25   NaN   alpha
  1     a        25           27   NaN    beta
  2     a        27           28    10    beta
  2     a        28           29    10   gamma
  3     a        29           30   2.5   gamma
  4     a        30         32.5    56   gamma
  5     a      32.5           36    18   gamma
  6     a        36           39     5   gamma
  7     b         0            3   0.5   alpha
  8     b         3            6   1.5   alpha
  9     b         6            9   2.5    beta
  10    b         9           18   NaN     phi
  11    b        18           25   NaN    teta
  </code></pre>
  
  <p>Is there an easy way to do that in pandas?</p>