Skip to content

Commit 2adaf77

Browse files
committed
BUG: BDay() offsetting not behaving as expected
1 parent 639a9c2 commit 2adaf77

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

pandas/tests/tseries/offsets/test_offsets.py

+31
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
from pandas.compat.numpy import np_datetime64_compat
2020
from pandas.errors import PerformanceWarning
2121

22+
import pandas as pd
2223
import pandas._testing as tm
2324
from pandas.core.indexes.datetimes import DatetimeIndex, date_range
2425
from pandas.core.series import Series
@@ -2326,6 +2327,36 @@ def test_datetimeindex(self):
23262327
for idx in [idx1, idx2, idx3]:
23272328
tm.assert_index_equal(idx, expected)
23282329

2330+
def test_bday_ignores_timedeltas(self):
2331+
idx = pd.date_range("2010/02/01", "2010/02/10", freq="12H")
2332+
t1 = idx + BDay(offset=pd.Timedelta(3, unit="H"))
2333+
2334+
expected = DatetimeIndex(
2335+
[
2336+
"2010-02-02 03:00:00",
2337+
"2010-02-02 15:00:00",
2338+
"2010-02-03 03:00:00",
2339+
"2010-02-03 15:00:00",
2340+
"2010-02-04 03:00:00",
2341+
"2010-02-04 15:00:00",
2342+
"2010-02-05 03:00:00",
2343+
"2010-02-05 15:00:00",
2344+
"2010-02-08 03:00:00",
2345+
"2010-02-08 15:00:00",
2346+
"2010-02-08 03:00:00",
2347+
"2010-02-08 15:00:00",
2348+
"2010-02-08 03:00:00",
2349+
"2010-02-08 15:00:00",
2350+
"2010-02-09 03:00:00",
2351+
"2010-02-09 15:00:00",
2352+
"2010-02-10 03:00:00",
2353+
"2010-02-10 15:00:00",
2354+
"2010-02-11 03:00:00",
2355+
],
2356+
freq=None,
2357+
)
2358+
tm.assert_index_equal(t1, expected)
2359+
23292360

23302361
class TestCustomBusinessHour(Base):
23312362
_offset = CustomBusinessHour

0 commit comments

Comments
 (0)