title: Pandas - merging start/end time ranges with short gaps
body: <p>Say I have a series of start and end times for a given event:</p>
  <pre><code>np.random.seed(1)
  df = pd.DataFrame(np.random.randint(1,5,30).cumsum().reshape(-1, 2), columns = [&quot;start&quot;, &quot;end&quot;])
  
      start  end
  0       2    6
  1       7    8
  2      12   14
  3      18   20
  4      24   25
  5      26   28
  6      29   33
  7      35   36
  8      39   41
  9      44   45
  10     48   50
  11     53   54
  12     58   59
  13     62   63
  14     65   68
  </code></pre>
  <p>I'd like to merge time ranges with a gap less than or equal to <code>n</code>, so for <code>n = 1</code> the result would be:</p>
  <pre><code>fn(df, n = 1)
  
      start  end
  0       2    8
  2      12   14
  3      18   20
  4      24   33
  7      35   36
  8      39   41
  9      44   45
  10     48   50
  11     53   54
  12     58   59
  13     62   63
  14     65   68
  </code></pre>
  <p>I can't seem to find a way to do this with <code>pandas</code> without iterating and building up the result line-by-line.  Is there some simpler way to do this?</p>