Skip to content

REF: simplify DTI._parse_string_to_bounds #31519

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 7 commits into from
Feb 5, 2020

Conversation

jbrockmendel
Copy link
Member

Sits on top of #31475. i.e. once that is merged, the only diff remaining here will be in indexes.datetimes.

After this, we are within striking distance of sharing the method between DTI/PI.

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

minor test nit otherwise lgtm

@@ -1186,6 +1186,13 @@ cdef int64_t period_ordinal_to_dt64(int64_t ordinal, int freq) except? -1:
if ordinal == NPY_NAT:
return NPY_NAT

if freq == 11000:
# Microsecond, avoid get_date_info to prevent floating point errors
pandas_datetime_to_datetimestruct(ordinal, NPY_FR_us, &dts)
Copy link
Member

Choose a reason for hiding this comment

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

unrelated but have you ever thought about renaming this function to something like "int64ns_to_datetimestruct"? I always find myself thinking about what a "pandas_datetime" is

Copy link
Member Author

Choose a reason for hiding this comment

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

i generally agree. i think it got this name because the numpy version is numpy_datetime_to_datetimestruct or something along those lines.

assert start == expected
assert start.value == per.ordinal * 1000

per2 = Period("2300-01-01", "us")
Copy link
Member

Choose a reason for hiding this comment

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

Can you split this off into a separate _raises test?

Copy link
Member Author

Choose a reason for hiding this comment

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

sure

@WillAyd WillAyd added the Period Period data type label Feb 1, 2020
@jbrockmendel jbrockmendel changed the title REF: simplift DTI._parse_string_to_bounds REF: simplify DTI._parse_string_to_bounds Feb 1, 2020
@jbrockmendel jbrockmendel added the Indexing Related to indexing on series/frames, not to indexes themselves label Feb 1, 2020
@jreback jreback added this to the 1.1 milestone Feb 5, 2020
@jreback jreback merged commit 33e86bf into pandas-dev:master Feb 5, 2020
@jreback
Copy link
Contributor

jreback commented Feb 5, 2020

nice, really simplfies

@jbrockmendel jbrockmendel deleted the parsed_string_to_bounds branch April 5, 2020 17:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Indexing Related to indexing on series/frames, not to indexes themselves Period Period data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants