Skip to content

Commit

Permalink
(WIP) BUG: resample by BusinessHour raises ValueError
Browse files Browse the repository at this point in the history
  • Loading branch information
Younggun Kim committed Aug 18, 2020
1 parent 13940c7 commit 7efaba9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from pandas.core.indexes.timedeltas import TimedeltaIndex, timedelta_range

from pandas.tseries.frequencies import is_subperiod, is_superperiod
from pandas.tseries.offsets import DateOffset, Day, Nano, Tick
from pandas.tseries.offsets import DateOffset, Day, Nano, Tick, BusinessHour

_shared_docs_kwargs: Dict[str, str] = dict()

Expand Down Expand Up @@ -1724,6 +1724,10 @@ def _get_timestamp_range_edges(
if isinstance(freq, Day):
first = first.tz_localize(index_tz)
last = last.tz_localize(index_tz)
# GH12351
elif issubclass(type(offset), BusinessHour):
first = offset.rollback(first)
last = offset.rollforward(last + offset)
else:
first = first.normalize()
last = last.normalize()
Expand Down

0 comments on commit 7efaba9

Please sign in to comment.