|
11 | 11 |
|
12 | 12 | from pandas.core.groupby import DataError
|
13 | 13 | from pandas.tseries.index import date_range
|
| 14 | +from pandas.tseries.tdi import timedelta_range |
14 | 15 | from pandas.tseries.offsets import Minute, BDay
|
15 | 16 | from pandas.tseries.period import period_range, PeriodIndex, Period
|
16 | 17 | from pandas.tseries.resample import DatetimeIndex, TimeGrouper
|
@@ -627,6 +628,21 @@ def test_resample_base(self):
|
627 | 628 | freq='5min')
|
628 | 629 | self.assertTrue(resampled.index.equals(exp_rng))
|
629 | 630 |
|
| 631 | + def test_resample_base_with_timedeltaindex(self): |
| 632 | + |
| 633 | + # GH 10530 |
| 634 | + rng = timedelta_range(start = '0s', periods = 25, freq = 's') |
| 635 | + ts = Series(np.random.randn(len(rng)), index = rng) |
| 636 | + |
| 637 | + with_base = ts.resample('2s', base = 5) |
| 638 | + without_base = ts.resample('2s') |
| 639 | + |
| 640 | + exp_without_base = timedelta_range(start = '0s', end = '25s', freq = '2s') |
| 641 | + exp_with_base = timedelta_range(start = '5s', end = '29s', freq = '2s') |
| 642 | + |
| 643 | + self.assertTrue(without_base.index.equals(exp_without_base)) |
| 644 | + self.assertTrue(with_base.index.equals(exp_with_base)) |
| 645 | + |
630 | 646 | def test_resample_daily_anchored(self):
|
631 | 647 | rng = date_range('1/1/2000 0:00:00', periods=10000, freq='T')
|
632 | 648 | ts = Series(np.random.randn(len(rng)), index=rng)
|
|
0 commit comments