-
-
Couldn't load subscription status.
- Fork 19.2k
ENH: partial string indexing on non-monotonic PeriodIndex #31096
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
Changes from all commits
6078f56
fda30f8
484df53
7867873
d8a6e48
7fcdc2c
ab92c5c
049c325
a8cc731
d98714a
10cdf50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,27 @@ including other versions of pandas. | |
| Enhancements | ||
| ~~~~~~~~~~~~ | ||
|
|
||
| .. _whatsnew_110.period_index_partial_string_slicing: | ||
|
|
||
| Nonmonotonic PeriodIndex Partial String Slicing | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
| :class:`PeriodIndex` now supports partial string slicing for non-monotonic indexes, mirroring :class:`DatetimeIndex` behavior (:issue:`31096`) | ||
|
|
||
| For example: | ||
|
|
||
| .. ipython:: python | ||
|
|
||
| dti = pd.date_range("2014-01-01", periods=30, freq="30D") | ||
| pi = dti.to_period("D") | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you show ser, maybe break this into 2 to make it more readable |
||
| ser_monotonic = pd.Series(np.arange(30), index=pi) | ||
| shuffler = list(range(0, 30, 2)) + list(range(1, 31, 2)) | ||
| ser = ser_monotonic[shuffler] | ||
| ser | ||
|
|
||
| .. ipython:: python | ||
| ser["2014"] | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. can you make a separate ipythonblock for these last 2 |
||
| ser.loc["May 2015"] | ||
|
|
||
| .. _whatsnew_110.enhancements.other: | ||
|
|
||
| Other enhancements | ||
|
|
||
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.
can you update the docs: https://pandas.io/docs/user_guide/timeseries.html#partial-string-indexing