-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
implement _local_timestamps in DatetimeArrayMixin #21721
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21721 +/- ##
==========================================
+ Coverage 91.93% 91.93% +<.01%
==========================================
Files 159 159
Lines 49719 49722 +3
==========================================
+ Hits 45707 45710 +3
Misses 4012 4012
Continue to review full report at Codecov.
|
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.
looks good, just some doc comments
pandas/core/indexes/datetimes.py
Outdated
reverse = np.empty(n, dtype=np.int_) | ||
reverse.put(indexer, np.arange(n)) | ||
return result.take(reverse) | ||
# fall back to non-optimized implementation |
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 would remove this comment
pandas/core/arrays/datetimes.py
Outdated
# Timezone Conversion and Localization Methods | ||
|
||
def _local_timestamps(self): | ||
values = self.asi8 |
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.
add a doc-string here (e.g. what are the return guarantees here)
""" | ||
values = self.asi8 | ||
indexer = values.argsort() | ||
result = conversion.tz_convert(values.take(indexer), utc, 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.
Does this only make sense if tz_convert
requires its input to be sorted? I don't think it does.
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.
yeah not sure why that indexer is there
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.
In the next pass I'll see if this can be simplified.
Broken out of #21715 because it is a blocker for a handful of orthogonal follow-ons.