title: How to perform a rolling average for irregular time intervals in pandas?
body: <p>I have a pandas dataframe of the form <code>df</code> :</p>
  
  <pre><code>timeCol      dataCol
  2              5
  9.135          8    
  11             4
  12             6
  </code></pre>
  
  <p>I want to do a rolling mean over a 3 second interval over <code>dataCol</code> such that it returns a dataframe of the form, <code>new_df</code> :</p>
  
  <pre><code>startTime    endTime    meanCol
  0               3        5.0
  1               4        5.0
  2               5        5.0
  3               6        0.0
  4               7        0.0
  5               8        0.0
  6               9        0.0   
  7               10       8.0
  8               11       6.0
  9               12       6.0
  10              13       5.0
  11              14       5.0
  12              15       6.0     
  </code></pre>
  
  <p>Notice, in <code>new_df</code>, for example, for time ranges (8-11) and (9-12), the value of 6.0 is returned (because <code>mean(8,4)=6.0</code> and <code>mean(8,4,6)=6.0</code> respectively. All columns are float type. <code>time_col</code> will always be ordered. What is an efficient, pythonic way of achieving this?</p>