title: Counting dates in a range set by pandas dataframe
body: <p>I have a pandas dataframe that contains two date columns, a start date and an end date that defines a range. I'd like to be able to collect a total count for all dates across all rows in the dataframe, as defined by these columns.</p>
  
  <p>For example, the table looks like:</p>
  
  <pre><code>index        start_date         end date
       0         '2015-01-01'    '2015-01-17'
       1         '2015-01-03'    '2015-01-12'
  </code></pre>
  
  <p>And the result would be a per date aggregate, like:</p>
  
  <pre><code>    date           count
  '2015-01-01'     1
  '2015-01-02'     1
  '2015-01-03'     2
  </code></pre>
  
  <p>and so on.</p>
  
  <p>My current approach works but is extremely slow on a big dataframe as I'm looping across the rows, calculating the range and then looping through this. I'm hoping to find a better approach. </p>
  
  <p>Currently I'm doing :</p>
  
  <pre><code>date = pd.date_range (min (df.start_date), max (df.end_date))
  df2 = pd.DataFrame (index =date)
  df2 ['count'] = 0
  
  for index, row in df.iterrows ():
      dates = pd.date_range (row ['start_date'], row ['end_date'])
      for date in dates:
          df2.loc['date']['count'] += 1
  </code></pre>