loffset has no effect when passing in a numyp.timedelta64 · Issue #7687 · pandas-dev/pandas (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
From mailing-list: [https://groups.google.com/forum/#!topic/pydata/CDnF9cNR2ho\]
When doing a re-sample, loffset has no effect if a numpy.timedelta64 is passed in:
In [1]: rng = pd.date_range('1/1/2012', periods=4, freq='S')
In [2]: ts = pd.Series(np.random.randint(0, 500, len(rng)), index=rng)
In [3]: ts.resample('2S') Out[3]: 2012-01-01 00:00:00 396.0 2012-01-01 00:00:02 214.5 Freq: 2S, dtype: float64
In [4]: import datetime
In [5]: ts.resample('2S',loffset=datetime.timedelta(seconds=10)) Out[5]: 2012-01-01 00:00:10 396.0 2012-01-01 00:00:12 214.5 dtype: float64
In [6]: ts.resample('2S',loffset=np.timedelta64(10,'s')) Out[6]: 2012-01-01 00:00:00 396.0 2012-01-01 00:00:02 214.5 Freq: 2S, dtype: float64