Skip to content

import from np_datetime instead of src/datetime #18312

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 1 commit into from
Nov 16, 2017

Conversation

jbrockmendel
Copy link
Member

There are a handful of things where there is an option to cimport from either tslibs.np_datetime or src/datetime.pxd. This PR updates imports use tslibs.np_datetime where possible.

Exposes NPY_NAT in nattype.pxd so other modules can cimport it from there instead of using util.get_nat(). Thematically nattype is the appropriate place for this to come from.

I don't think this has any overlaps with #18298.

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

@@ -50,6 +50,11 @@ cdef extern from "../src/datetime/np_datetime.h":
PANDAS_FR_fs
PANDAS_FR_as

int days_per_month_table[2][12]
int dayofweek(int y, int m, int d) nogil
int is_leapyear(int64_t year) nogil
Copy link
Member Author

Choose a reason for hiding this comment

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

There are a couple of modules that use one or more of these three items but dont need the rest of the relatively heavy-weight src/datetime/np_datetime dependency. Ideally I'd prefer for these to be implemented in a dependency-free cython module.

Copy link
Contributor

Choose a reason for hiding this comment

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

sure these are like dateutils

@codecov
Copy link

codecov bot commented Nov 15, 2017

Codecov Report

Merging #18312 into master will decrease coverage by 0.01%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18312      +/-   ##
==========================================
- Coverage   91.39%   91.38%   -0.02%     
==========================================
  Files         164      164              
  Lines       49854    49854              
==========================================
- Hits        45566    45557       -9     
- Misses       4288     4297       +9
Flag Coverage Δ
#multiple 89.18% <ø> (ø) ⬆️
#single 39.44% <ø> (-0.07%) ⬇️
Impacted Files Coverage Δ
pandas/io/gbq.py 25% <0%> (-58.34%) ⬇️
pandas/core/frame.py 97.8% <0%> (-0.1%) ⬇️

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 c2590b3...6d297f1. Read the comment docs.

@jreback jreback added Clean Datetime Datetime data dtype labels Nov 15, 2017
@jreback jreback added this to the 0.22.0 milestone Nov 15, 2017
@@ -50,6 +50,11 @@ cdef extern from "../src/datetime/np_datetime.h":
PANDAS_FR_fs
PANDAS_FR_as

int days_per_month_table[2][12]
int dayofweek(int y, int m, int d) nogil
int is_leapyear(int64_t year) nogil
Copy link
Contributor

Choose a reason for hiding this comment

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

sure these are like dateutils

@jreback jreback merged commit fe1bfd7 into pandas-dev:master Nov 16, 2017
@jreback
Copy link
Contributor

jreback commented Nov 16, 2017

thanks!

@jbrockmendel
Copy link
Member Author

sure these are like dateutils

Really? I was expecting a "no" because it would be duplicating stuff already in src/datetime/np_datetime, but if that's the go-ahead, then I'll put that together this week. Name-wise I was thinking ccalendar by analogy with cchardet (hence the branch name).

@jbrockmendel jbrockmendel deleted the ccalendar branch November 16, 2017 00:56
@jreback
Copy link
Contributor

jreback commented Nov 16, 2017

well i wouldn’t duplicate stuff rather should be orthogonal - maybe not sure what u r proposing here

@jbrockmendel
Copy link
Member Author

No worries, I've got plenty of other stuff to work on, will get distracted by something shiny and forget about this idea.

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