-
-
Notifications
You must be signed in to change notification settings - Fork 18.2k
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
Separate conversion functions out from tslib #17875
Conversation
Hello @jbrockmendel! Thanks for updating the PR. Cheers ! There are no PEP8 issues in this Pull Request. 🍻 Comment last updated on October 29, 2017 at 22:06 Hours UTC |
Codecov Report
@@ Coverage Diff @@
## master #17875 +/- ##
==========================================
- Coverage 91.23% 91.21% -0.02%
==========================================
Files 163 163
Lines 50102 50102
==========================================
- Hits 45712 45703 -9
- Misses 4390 4399 +9
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17875 +/- ##
==========================================
- Coverage 91.26% 91.22% -0.05%
==========================================
Files 163 163
Lines 50099 50099
==========================================
- Hits 45724 45703 -21
- Misses 4375 4396 +21
Continue to review full report at Codecov.
|
rebase |
if we accep this PR, what then? this just moves the conversion functions out but doesn't actually simplify things AFAICT. what is the next step? |
You're absolutely right. Keep in mind that to make reviewing easier I'm trying to strictly separate cut/paste PRs from actual-changes PRs. Three goals in mind:
|
pandas/_libs/tslibs/conversion.pyx
Outdated
|
||
@cython.boundscheck(False) | ||
@cython.wraparound(False) | ||
cdef inline str _render_tstamp(int64_t val): |
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.
so instead of doing this, why don't you simply do
from pandas._libs.tslib import Timestamp
return str(Timestamp(val))
of course this is a local import and only occurs when you are raising anyhow.
much more obvious
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 thought about this and couldn't fight off the allure of self-contained-ness. Will change.
setup.py
Outdated
@@ -493,6 +494,9 @@ def pxd(name): | |||
'pxdfiles': ['_libs/src/util', '_libs/lib'], | |||
'depends': tseries_depends, | |||
'sources': npdt_srces}, | |||
'_libs.tslibs.conversion': {'pyxfile': '_libs/tslibs/conversion', | |||
'depends': tseries_depends, | |||
'sources': npdt_srces}, |
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.
comment from before, rename npdt_srces -> np_datetime_sources. Please don't abbreviate things, it makes it much harder to read.
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.
Yah, this change definitely made it into one or two of the ongoing PRs, hasn't caught up to all of them yet.
|
||
cdef inline bisect_right_i8(int64_t *data, int64_t val, Py_ssize_t n): | ||
cdef Py_ssize_t pivot, left = 0, right = n | ||
|
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 an assert n >= 1 here
needs a rebase |
Since this has already been reviewed in its current form, my preference is to close it out and then follow-up with to use e.g. |
thanks! |
Awesome! There's some accumulated cleanup that needs to be done. Quick question since micro-optimizations matter here. Do we need to care about the difference between:
? |
The functions moved are cut/paste with two exceptions: a flake8 whitespace fixup and the new helper function
conversion._render_tstamp
.About half of the remaining
_TSObject
conversion funcs can be moved once #17805 is merged. The remainder can be isolated after #17793.