title: merge rows pandas dataframe based on condition
body: <p>Hi have a dataframe <code>df</code></p>
  
  <p>containing a set of events (rows).</p>
  
  <pre><code>df = pd.DataFrame(data=[[1, 2,   7, 10],
                     [10, 22, 1, 30],
                     [30, 42, 2, 10],  
                     [100,142, 22,1],
                     [143, 152, 2, 10],
                     [160, 162, 12, 11]],columns=['Start','End','Value1','Value2'])
  
   df
  Out[15]: 
     Start  End  Value1  Value2
  0      1    2       7      10
  1     10   22       1      30
  2     30   42       2      10
  3    100  142      22       1
  4    143  152       2      10
  5    160  162      12      11
  </code></pre>
  
  <p>If 2 (or more) consecutive events are &lt;= 10 far apart I would like to merge the 2 (or more) events (i.e. use the start of the first event, end of the last and sum the values in Value1 and Value2).</p>
  
  <p>In the example above df becomes:</p>
  
  <pre><code> df
  Out[15]: 
     Start  End  Value1  Value2
  0      1   42      10      50
  1    100  162      36      22
  </code></pre>