-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
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
Conversation
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) |
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.
@jreback i think you wrote most of this, do you remember what the reso checks here are for?
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.
nope
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. |
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 merge on green.
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.