-
-
Notifications
You must be signed in to change notification settings - Fork 19k
BUG: Fix inconsistency with DateOffset near DST #61870
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
base: main
Are you sure you want to change the base?
BUG: Fix inconsistency with DateOffset near DST #61870
Conversation
pandas/_libs/tslibs/offsets.pyx
Outdated
if not kwds: | ||
from dateutil.relativedelta import relativedelta | ||
|
||
# GH 45643/45890: (historically) defaults to 1 day |
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.
the comment here needs adjusting?
|
||
@pytest.mark.parametrize("n", [-1, 1, 3]) | ||
def test_construct_int_arg_no_kwargs_assumed_days(n): | ||
from dateutil.relativedelta import relativedelta |
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.
can this go at the top of the file
def test_construct_int_arg_no_kwargs_assumed_days(n): | ||
from dateutil.relativedelta import relativedelta | ||
|
||
# GH 45890, 45643 |
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.
update
can you add a whatsnew note |
pre-commit.ci autofix |
for more information, see https://pre-commit.ci
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
|
||
import warnings | ||
|
||
from dateutil.relativedelta import relativedelta |
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.
is this imported at top-level anywhere else in the repo? not sure but we might be delaying this import to improve import pandas as pd
speed
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.
On main it is a localized import in this file on line 328
if all(k in kwds_use_relativedelta for k in kwds_no_nanos):
from dateutil.relativedelta import relativedelta
return relativedelta(**kwds_no_nanos), True
Added type annotations to new arguments/methods/functions.doc/source/whatsnew/vX.X.X.rst
file if fixing a bug or adding a new feature.This fix ensures that
pd.offsets.DateOffset(1)
andpd.offsets.DateOffset(days=1)
return the same value near a DST transition.