-
-
Notifications
You must be signed in to change notification settings - Fork 18.7k
DEPR: tz_convert in the Timestamp constructor #23621
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
DEPR: tz_convert in the Timestamp constructor #23621
Conversation
Hello @mroeschke! Thanks for submitting the PR.
|
Codecov Report
@@ Coverage Diff @@
## master #23621 +/- ##
==========================================
+ Coverage 92.23% 92.23% +<.01%
==========================================
Files 161 161
Lines 51408 51427 +19
==========================================
+ Hits 47416 47434 +18
- Misses 3992 3993 +1
Continue to review full report at Codecov.
|
lgtm. can you add to the deprecations list, issue #6581 can you replicate your tests on Timestamp on DTI (if they already exist can you xref that test with this issue / PR number) not sure what is failing. |
can you rebase, looks fine. |
@@ -967,7 +967,10 @@ def get_loc(self, key, method=None, tolerance=None): | |||
|
|||
if isinstance(key, datetime): | |||
# needed to localize naive datetimes | |||
key = Timestamp(key, tz=self.tz) | |||
if key.tzinfo is None: | |||
key = Timestamp(key, tz=self.tz) |
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 think using .tz_localize() here is more explict
@@ -967,7 +967,10 @@ def get_loc(self, key, method=None, tolerance=None): | |||
|
|||
if isinstance(key, datetime): | |||
# needed to localize naive datetimes |
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.
also can you modify this comment to reflect the code
9b5c8e7
to
96da473
Compare
can you run some asvs to see if we have perf issues |
No regressions according to the asvs.
|
thanks @mroeschke |
git diff upstream/master -u -- "*.py" | flake8 --diff
To have consistent behavior with
DatetimeIndex
, deprecate thetz_convert
behavior of theTimestamp
constructor with thetz
arg.