-
-
Notifications
You must be signed in to change notification settings - Fork 18.3k
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
Move fields functions out of the way #17770
Conversation
Hello @jbrockmendel! Thanks for updating the PR.
Comment last updated on October 04, 2017 at 14:36 Hours UTC |
Codecov Report
@@ Coverage Diff @@
## master #17770 +/- ##
==========================================
- Coverage 91.26% 91.24% -0.02%
==========================================
Files 163 163
Lines 49872 49872
==========================================
- Hits 45514 45505 -9
- Misses 4358 4367 +9
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17770 +/- ##
==========================================
- Coverage 91.26% 91.24% -0.02%
==========================================
Files 163 163
Lines 49872 49872
==========================================
- Hits 45514 45505 -9
- Misses 4358 4367 +9
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #17770 +/- ##
==========================================
- Coverage 91.26% 91.22% -0.04%
==========================================
Files 163 163
Lines 49872 49917 +45
==========================================
+ Hits 45514 45536 +22
- Misses 4358 4381 +23
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.
lgtm. some comments. ping on green.
pandas/_libs/tslibs/fields.pyx
Outdated
from numpy cimport ndarray, int64_t, int32_t, int8_t | ||
np.import_array() | ||
|
||
cdef int64_t NPY_NAT = np.datetime64('NaT').astype(np.int64) |
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.
use util.get_nat(), don't change the incantation
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.
Had hoped to avoid dependency; changing.
pandas/_libs/tslibs/fields.pyx
Outdated
return days_per_month_table[is_leapyear(dts.year)][dts.month -1] | ||
|
||
|
||
cpdef _isleapyear_arr(ndarray years): |
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 de-privatize
pandas/_libs/tslibs/fields.pyx
Outdated
cdef: | ||
ndarray[int8_t] out | ||
|
||
# to make NaT result as False |
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 think ok to remove this comment (instead add a doc-string)
I think this would be a difficult change FYI |
thanks! |
Notes:
The only usage in
tslib
ofget_date_name_field
is forTimestamp.weekday
and can be simplified with a more direct call.Several of the functions from
tslibs.fields
imported intotslib
are unused. Updating the external imports to use the new locations is for a follow-up.There is some flake8 cleanup to be done in the the new
tslibs.fields
, but that is being saved for a follow-up. For now this is just cut/paste.get_start_end_field
will be largely unnecessary if/when the suggestion to deprecate Timestamp.freq in DEPR: remove freq attribute of Timestamp? #15146 is adopted.closes #xxxx
tests added / passed
passes
git diff upstream/master -u -- "*.py" | flake8 --diff
whatsnew entry