title: Pandas Dataframe with start and end date, combine connected dates from multiple rows to one row
body: <p>Lets assume I have the following df:</p>
  <pre><code>category    start   end
  0   A   2015-01-01  2016-01-01
  1   A   2016-01-01  2016-06-01
  2   A   2016-06-01  2016-12-01
  3   B   2016-01-01  2016-07-01
  4   B   2018-01-01  2018-08-01
  </code></pre>
  <p>Now for each category, if the previous rows end date is equal to current rows start date, i'd like to &quot;merge&quot; them, and if not just keep them. Keeping the index is not important.
  The output would be</p>
  <pre><code>category    start   end
  0   A   2015-01-01  2016-12-01
  3   B   2016-01-01  2016-07-01
  4   B   2018-01-01  2018-08-01
  </code></pre>
  <pre><code>a = {'category':['A', 'A', 'A', 'B', 'B']}
  b = {'start': [datetime(2015, 1,1).date(), datetime(2016, 1,1).date(), datetime(2016, 6, 1).date(), datetime(2016, 1,1).date(), datetime(2018, 1,1).date()]}
  c = {'end':[datetime(2016, 1,1).date(), datetime(2016, 6,1).date(), datetime(2016, 12, 1).date(), datetime(2016, 7,1).date(), datetime(2018, 8,1).date()]}
  
  a.update(b)
  a.update(c)
  df = pd.DataFrame.from_dict(a)
  
  </code></pre>
  <p>My original DataFrame has about 8 million rows. By doing this I could get that down to about 1 million. But it has to be able to perform on somewhat &quot;large&quot; data.</p>