title: How to calculate average of sub-lists based on Timestamp values
body: <p>I have 2 lists. The 1st list is the Timestamps (sec) when data was measured. And 2nd list contains data.</p>
  
  <p>I want to calculate the average of data every 10 sec. Note that timestamp between 2 consecutive data points is not fixed. </p>
  
  <p>Example:</p>
  
  <pre><code>Timestamp = [2, 5, 8, 11, 18, 23, 25, 28]
  Data = [1, 2, 3, 4, 5, 6, 7, 8]
  </code></pre>
  
  <p>And the expected output is supposed to be:</p>
  
  <pre><code>Output = [average of [1,2,3] , average of [4,5] , average of [6,7,8]]
  </code></pre>
  
  <p>I was wondering if there is any built-in function in Python like average-if analysis to do it automatically.</p>
  
  <p>Thank you for your help.</p>