Skip to content

Commit f355763

Browse files
author
Younggun Kim
committed
TST: Test CustomBusinessHour resampling (pandas-dev#12351)
follow up to GH16447
1 parent d856d66 commit f355763

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

pandas/tests/test_resample.py

+19-4
Original file line numberDiff line numberDiff line change
@@ -2564,21 +2564,36 @@ def test_upsample_daily_business_daily(self):
25642564
expected = ts.asfreq('H', how='s').reindex(exp_rng)
25652565
assert_series_equal(result, expected)
25662566

2567-
2568-
# GH12351
25692567
def test_resample_business_hourly(self):
2568+
# GH12351
25702569
rng = pd.date_range(start='2017-05-18 00:00:00',
25712570
end='2017-05-19 23:00:00',
25722571
freq='H')
25732572
expected_rng = pd.date_range(start='2017-05-18 00:00:00',
2574-
end='2017-05-19 23:00:00',
2575-
freq='BH')
2573+
end='2017-05-19 23:00:00',
2574+
freq='BH')
25762575
ts = Series(1, index=rng)
25772576
result = ts.asfreq('BH')
25782577
expected_ts = Series(1, index=expected_rng)
25792578

25802579
assert_series_equal(result, expected_ts)
25812580

2581+
def test_resample_custom_business_hourly(self):
2582+
# GH12351
2583+
rng = pd.date_range(start='2017-05-18 00:00:00',
2584+
end='2017-05-19 23:00:00',
2585+
freq='H')
2586+
2587+
hours = offsets.CustomBusinessHour(start='10:00')
2588+
expected_rng = pd.date_range(start='2017-05-18 00:00:00',
2589+
end='2017-05-19 23:00:00',
2590+
freq=hours)
2591+
2592+
ts = Series(1, index=rng)
2593+
result = ts.asfreq(hours)
2594+
expected_ts = Series(1, index=expected_rng)
2595+
2596+
assert_series_equal(result, expected_ts)
25822597

25832598
def test_resample_irregular_sparse(self):
25842599
dr = date_range(start='1/1/2012', freq='5min', periods=1000)

0 commit comments

Comments
 (0)