@@ -2564,21 +2564,36 @@ def test_upsample_daily_business_daily(self):
2564
2564
expected = ts .asfreq ('H' , how = 's' ).reindex (exp_rng )
2565
2565
assert_series_equal (result , expected )
2566
2566
2567
-
2568
- # GH12351
2569
2567
def test_resample_business_hourly (self ):
2568
+ # GH12351
2570
2569
rng = pd .date_range (start = '2017-05-18 00:00:00' ,
2571
2570
end = '2017-05-19 23:00:00' ,
2572
2571
freq = 'H' )
2573
2572
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' )
2576
2575
ts = Series (1 , index = rng )
2577
2576
result = ts .asfreq ('BH' )
2578
2577
expected_ts = Series (1 , index = expected_rng )
2579
2578
2580
2579
assert_series_equal (result , expected_ts )
2581
2580
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 )
2582
2597
2583
2598
def test_resample_irregular_sparse (self ):
2584
2599
dr = date_range (start = '1/1/2012' , freq = '5min' , periods = 1000 )
0 commit comments