Skip to content

REF: use _get_string_slice in PeriodIndex.get_value #31058

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 6 commits into from
Jan 20, 2020

Conversation

jbrockmendel
Copy link
Member

Most of _get_string_slice is duplicated inside PeriodIndex.get_value, which likely explains why get_string_slice has almost no test coverage. This also brings PeriodIndex.get_value into closer alignment with DatetimeIndex.get_value, so we may be able to share code a few steps from here.

if not self.is_monotonic:
raise ValueError("Partial indexing only valid for ordered time series")

key, parsed, reso = parse_time_string(key, self.freq)
grp = resolution.Resolution.get_freq_group(reso)
freqn = resolution.get_freq_group(self.freq)
if reso in ["day", "hour", "minute", "second"] and not grp < freqn:
raise KeyError(key)
Copy link
Member Author

Choose a reason for hiding this comment

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

@jreback i think you wrote most of this, do you remember what the reso checks here are for?

Copy link
Contributor

Choose a reason for hiding this comment

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

nope

@jbrockmendel jbrockmendel added the Indexing Related to indexing on series/frames, not to indexes themselves label Jan 17, 2020
@jreback
Copy link
Contributor

jreback commented Jan 18, 2020

needs a rebase, this overalaps with #31096 ?

@jreback jreback added the Period Period data type label Jan 18, 2020
@jreback jreback added this to the 1.1 milestone Jan 18, 2020
@jreback jreback added the Clean label Jan 18, 2020
@jbrockmendel
Copy link
Member Author

needs a rebase, this overalaps with #31096 ?

rebased+green. the diff overlaps so 31096 will probably need to be rebased, but they are logically independent.

Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

lgtm merge on green.

@jreback jreback merged commit cd20c95 into pandas-dev:master Jan 20, 2020
@jbrockmendel jbrockmendel deleted the ref-pi-slice branch January 20, 2020 19:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean 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.

2 participants