Skip to content

WIP: implement period_helper in cython #19498

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

Closed
wants to merge 11 commits into from

Conversation

jbrockmendel
Copy link
Member

Tests pass locally, haven't run asv yet. Lots of cleanup to do; function names are retained, use camelCase. A bunch of functions overlap with ccalendar (even more so if we remove the unused non-GREGORIAN_CALENDAR case)

@codecov
Copy link

codecov bot commented Feb 2, 2018

Codecov Report

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

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #19498      +/-   ##
==========================================
- Coverage   91.67%   91.62%   -0.06%     
==========================================
  Files         148      150       +2     
  Lines       48553    48681     +128     
==========================================
+ Hits        44513    44604      +91     
- Misses       4040     4077      +37
Flag Coverage Δ
#multiple 89.99% <ø> (-0.05%) ⬇️
#single 41.73% <ø> (+0.01%) ⬆️
Impacted Files Coverage Δ
pandas/errors/__init__.py 92.3% <0%> (-7.7%) ⬇️
pandas/core/arrays/categorical.py 94.74% <0%> (-1.04%) ⬇️
pandas/core/internals.py 95.05% <0%> (-0.42%) ⬇️
pandas/plotting/_core.py 82.23% <0%> (-0.18%) ⬇️
pandas/tseries/offsets.py 97% <0%> (-0.09%) ⬇️
pandas/core/dtypes/dtypes.py 96.08% <0%> (-0.04%) ⬇️
pandas/core/arrays/__init__.py 100% <0%> (ø) ⬆️
pandas/core/dtypes/base.py 47.61% <0%> (ø)
pandas/core/arrays/base.py 56.66% <0%> (ø)
pandas/core/reshape/merge.py 94.22% <0%> (ø) ⬆️
... and 5 more

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 78ba063...639d03d. Read the comment docs.

@jreback jreback added Period Period data type Clean labels Feb 4, 2018
# Conventions

@cython.cdivision
cdef inline int get_freq_group_index(int freq) nogil:
Copy link
Contributor

Choose a reason for hiding this comment

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

maybe lets make a pandas._libs/period/.... subdir here rather than trying to jam into tslibs (and move period as well)

Copy link
Contributor

Choose a reason for hiding this comment

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

a precursor PR to move period would make this easier

Copy link
Member Author

Choose a reason for hiding this comment

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

This is definitely a mess; unfortunately my attempts to port it piece-meal segfaulted all over the place.

But I think this does belong in tslibs. A ton of the code moved from period_helper is redundant with np_datetime, ccalendar (if we get rid of the unused JULIAN_CALENDAR branches), and frequencies.

Copy link
Member Author

Choose a reason for hiding this comment

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

@shoyer IIRC you mentioned xarray users needing non-gregorian calendar implementations of... something. Am I remembering that right? If so, is there anything useful in the JULIAN_CALENDAR code for period_helper that should be retained instead of ripped out?

Copy link
Contributor

Choose a reason for hiding this comment

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

ok, still make it a subdir, maybe pandas/_lib/tslibs/period then

Copy link
Member

Choose a reason for hiding this comment

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

I don't think the Julian calendar part is worth keeping around for xarray users.

Climate scientists use non-Gregorian calendars (e.g., a "365 day calendar") to simplify keeping track of seasons in climate models. But I don't think the Julian calendar is particularly interesting here.

@jbrockmendel
Copy link
Member Author

Closing in favor of #19534 and follow-ups.

@jbrockmendel jbrockmendel deleted the phelper3 branch February 11, 2018 21:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

period_helper should be in cython
3 participants