title: Resample Series/DataFrame with frequency anchored to specific time
body: <p>I have inhomogeneous ~secondly data with a time series index that looks like:</p>
  
  <pre><code>import numpy as np
  import pandas as pd
  
  dates = [pd.datetime(2012, 2, 5, 17,00,35,327000), pd.datetime(2012, 2, 5, 17,00,37,325000),pd.datetime(2012, 2, 5, 17,00,37,776000),pd.datetime(2012, 2, 5, 17,00,38,233000),pd.datetime(2012, 2, 5, 17,00,40,946000),pd.datetime(2012, 2, 5, 17,00,41,327000),pd.datetime(2012, 2, 5, 17,00,42,06000),pd.datetime(2012, 2, 5, 17,00,44,99000),pd.datetime(2012, 2, 5, 17,00,44,99000),pd.datetime(2012, 2, 5, 17,00,46,289000),pd.datetime(2012, 2, 5, 17,00,49,96000),pd.datetime(2012, 2, 5, 17,00,53,240000)]
  
  inhomogeneous_secondish_series = pd.Series(np.random.randn(len(dates)), name='some_col', index=pd.DatetimeIndex(dates))
  </code></pre>
  
  <hr>
  
  <pre><code>In [26]: inhomogeneous_secondish_series
  Out[26]: 
  2012-02-05 17:00:35.327000   -0.903398
  2012-02-05 17:00:37.325000    0.535798
  2012-02-05 17:00:37.776000    0.847231
  2012-02-05 17:00:38.233000   -1.280244
  2012-02-05 17:00:40.946000    1.330232
  2012-02-05 17:00:41.327000    2.287555
  2012-02-05 17:00:42.003072   -1.469432
  2012-02-05 17:00:44.099000   -1.174953
  2012-02-05 17:00:44.099000   -1.020135
  2012-02-05 17:00:46.289000   -0.200043
  2012-02-05 17:00:49.096000   -0.665699
  2012-02-05 17:00:53.240000    0.748638
  Name: some_col
  </code></pre>
  
  <p>Which I want to resample to say '5s'. Normally I would do:</p>
  
  <pre><code>In [28]: inhomogeneous_secondish_series.resample('5s')
  </code></pre>
  
  <p>This yields nicely resampled 5s data anchored to the 0th second; In the result each item in the index will be on a multiple of 5 seconds from the 0th second of a given minute:</p>
  
  <pre><code>2012-02-05 17:00:40   -0.200153
  2012-02-05 17:00:45   -0.009347
  2012-02-05 17:00:50   -0.432871
  2012-02-05 17:00:55    0.748638
  Freq: 5S
  </code></pre>
  
  <p>How would I instead have the resampled data anchored around the time of the <strong>most recent</strong> sample, so the index would look like:</p>
  
  <pre><code>...
  2012-02-05 17:00:38.240000  (some correct resample value)
  2012-02-05 17:00:43.240000  (some correct resample value)
  2012-02-05 17:00:48.240000  (some correct resample value)
  2012-02-05 17:00:53.240000  (some correct resample value)
  Freq: 5S
  </code></pre>
  
  <p>I expect the answer probably lies in the loffset paramater for resample() but wondering if there is a more simple way than having to calculate the loffset prior to resampling. Would I have to look at the latest sample, figure out it's offset from the nearest normal 5s frequency and feed that into the loffset?</p>