-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
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
Conversation
Codecov Report
@@ Coverage Diff @@
## master #22181 +/- ##
=======================================
Coverage 92.06% 92.06%
=======================================
Files 169 169
Lines 50694 50694
=======================================
Hits 46671 46671
Misses 4023 4023
Continue to review full report at Codecov.
|
pandas/_libs/tslibs/conversion.pyx
Outdated
# 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): |
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 you name this something else, it is pretty confusing
thanks! |
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 passedvals
have a high proportion ofiNaT
s.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
)git diff upstream/master -u -- "*.py" | flake8 --diff