Skip to content

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

Merged
merged 3 commits into from
Jul 5, 2018

Conversation

jbrockmendel
Copy link
Member

Broken out of #21715 because it is a blocker for a handful of orthogonal follow-ons.

@codecov
Copy link

codecov bot commented Jul 4, 2018

Codecov Report

Merging #21721 into master will increase coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #21721      +/-   ##
==========================================
+ Coverage   91.93%   91.93%   +<.01%     
==========================================
  Files         159      159              
  Lines       49719    49722       +3     
==========================================
+ Hits        45707    45710       +3     
  Misses       4012     4012
Flag Coverage Δ
#multiple 90.3% <100%> (ø) ⬆️
#single 42.02% <27.27%> (ø) ⬆️
Impacted Files Coverage Δ
pandas/core/arrays/datetimes.py 100% <100%> (ø) ⬆️
pandas/core/indexes/datetimes.py 95.45% <100%> (-0.03%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 9b24770...70e4047. Read the comment docs.

Copy link
Contributor

@jreback jreback left a 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

reverse = np.empty(n, dtype=np.int_)
reverse.put(indexer, np.arange(n))
return result.take(reverse)
# fall back to non-optimized implementation
Copy link
Contributor

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

# Timezone Conversion and Localization Methods

def _local_timestamps(self):
values = self.asi8
Copy link
Contributor

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)

@jreback jreback added Datetime Datetime data dtype Clean labels Jul 4, 2018
@jreback jreback added this to the 0.24.0 milestone Jul 4, 2018
"""
values = self.asi8
indexer = values.argsort()
result = conversion.tz_convert(values.take(indexer), utc, self.tz)
Copy link
Member Author

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.

Copy link
Contributor

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

Copy link
Member Author

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.

@jreback jreback merged commit 7733530 into pandas-dev:master Jul 5, 2018
@jbrockmendel jbrockmendel deleted the local_timestamps branch July 6, 2018 14:36
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this pull request Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Datetime Datetime data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants