Skip to content

Commit 4b5b391

Browse files
committed
Added tests for updated resample function
1 parent 91ff143 commit 4b5b391

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/test_tseries.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -423,6 +423,17 @@ def test_series_bin_grouper():
423423
exp_counts = np.array([3, 3, 4], dtype=np.int64)
424424
assert_almost_equal(counts, exp_counts)
425425

426+
def test_resample_with_timedeltaindex():
427+
from pandas import DataFrame
428+
from pandas import timedelta_range
429+
430+
df = DataFrame(np.random.normal(size = (100, 4)))
431+
df.index = timedelta_range(start='0s', periods=100, freq='s')
432+
resample = df.resample('10s', base = 5)
433+
assert_almost_equal(resample.index[0].seconds, 5)
434+
435+
with tm.assertRaises(Exception):
436+
df.resample('10s', base=15)
426437

427438
class TestBinGroupers(tm.TestCase):
428439
_multiprocess_can_split_ = True

0 commit comments

Comments
 (0)