Skip to content

Standardize special case in tz_conversion functions #22181

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 9 commits into from
Aug 8, 2018

Conversation

jbrockmendel
Copy link
Member

ATM _tz_convert_dst handles iteration and masking differently (and more complicated-ly) than other related functions. AFAICT the reasoning is that this implementation is performant when the passed vals have a high proportion of iNaTs.

By changing this special case to conform to the standard pattern, we allow other functions to call this without having to do any special casting, generally simplify things, and open the door to de-duplicating these functions (which this PR also starts doing by implementing _tz_convert)

  • closes #xxxx
  • tests added / passed
  • passes git diff upstream/master -u -- "*.py" | flake8 --diff
  • whatsnew entry

@codecov
Copy link

codecov bot commented Aug 3, 2018

Codecov Report

Merging #22181 into master will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master   #22181   +/-   ##
=======================================
  Coverage   92.06%   92.06%           
=======================================
  Files         169      169           
  Lines       50694    50694           
=======================================
  Hits        46671    46671           
  Misses       4023     4023
Flag Coverage Δ
#multiple 90.47% <ø> (ø) ⬆️
#single 42.32% <ø> (ø) ⬆️

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 def50e2...624e1a8. Read the comment docs.

@gfyoung gfyoung added Timezones Timezone data dtype Clean labels Aug 3, 2018
@gfyoung gfyoung requested a review from jreback August 3, 2018 02:52
# Note: at least with cython 0.28.3, doing a lookup `[0]` in the next
# line is sensitive to the declared return type of _tz_convert_dst;
# if it is declared as returning ndarray[int64_t], a compile-time error
# is raised.
return _tz_convert_dst(arr, tz2, to_utc=False)[0]


cdef inline int64_t[:] _tz_convert(int64_t[:] vals, object tz, bint to_utc):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you name this something else, it is pretty confusing

@jreback jreback added this to the 0.24.0 milestone Aug 8, 2018
@jreback jreback merged commit e5a2969 into pandas-dev:master Aug 8, 2018
@jreback
Copy link
Contributor

jreback commented Aug 8, 2018

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Timezones Timezone data dtype
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants