-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG: Fix creating DatetimeIndex with BusinessHour Frequency #50530
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
BUG: Fix creating DatetimeIndex with BusinessHour Frequency #50530
Conversation
…eindienst/pandas into fix-DatetimeIndex-w-BusinessHour
doc/source/whatsnew/v1.5.3.rst
Outdated
@@ -30,7 +30,7 @@ Bug fixes | |||
- Bug in :meth:`.Styler.to_excel` leading to error when unrecognized ``border-style`` (e.g. ``"hair"``) provided to Excel writers (:issue:`48649`) | |||
- Bug when chaining several :meth:`.Styler.concat` calls, only the last styler was concatenated (:issue:`49207`) | |||
- Fixed bug when instantiating a :class:`DataFrame` subclass inheriting from ``typing.Generic`` that triggered a ``UserWarning`` on python 3.11 (:issue:`49649`) | |||
- | |||
- Fixed bug in :class:`BusinessHour` that could cause creation of ``DatetimeIndex`` to fail (:issue:`#49835`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Fixed bug in :class:`BusinessHour` that could cause creation of ``DatetimeIndex`` to fail (:issue:`#49835`) | |
- Fixed bug in :class:`BusinessHour` that could cause creation of :class:`DatetimeIndex` to fail (:issue:`49835`) |
- Could you move this to
v2.0.0.rst
? - Could you make this description more specific too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've written it like this now, is that ok?
- Bug in :class:`BusinessHour` would cause creation of :class:`DatetimeIndex` to fail when no opening hour was included in the index (:issue:`#49835`)
Thanks for reviewing!
Great! Thanks @DavidKleindienst |
DatetimeIndex creating with BusinessHour Frequency would fail whenever the DatetimeIndex did not include a Timestamp that was also an opening time.
The cause of the issue was a bug where adding/subtracting
0 * BusinessHour
gave wrong results:returns
Timestamp('2020-01-02 09:00:00')
rather than the expectedTimestamp('2020-01-01 10:00:00')
This PR fixes the problem and adds appropriate assertions to the unit-tests
doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.