-
-
Notifications
You must be signed in to change notification settings - Fork 18k
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
API/DEPR: 'periods' argument instead of 'n' for PeriodIndex.shift() #22912
Conversation
Hello @arminv! Thanks for updating the PR.
Comment last updated on October 08, 2018 at 18:08 Hours UTC |
Codecov Report
@@ Coverage Diff @@
## master #22912 +/- ##
=========================================
Coverage ? 92.19%
=========================================
Files ? 169
Lines ? 50879
Branches ? 0
=========================================
Hits ? 46910
Misses ? 3969
Partials ? 0
Continue to review full report at Codecov.
|
@TomAugspurger can you review please? |
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.
I didn't closely follow the issue and other discussion, but I just want to double-check that we really want to do this. DatetimeIndex / PeriodIndex.shift are fundamentally different from Series.shift, (shifting values vs. position). Still, I think changing the argument name is still for the best.
pandas/core/arrays/period.py
Outdated
|
||
See Also | ||
-------- | ||
Index.shift : Shift values of Index. |
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.
I think remove this. Index.shift isn't implemented, it's just for the date-like subclasses.
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 this @arminv
this is ok, we have an inconsistency in named args now. |
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.
ping on green.
doc/source/whatsnew/v0.24.0.txt
Outdated
@@ -573,7 +573,7 @@ Deprecations | |||
- :meth:`Series.str.cat` has deprecated using arbitrary list-likes *within* list-likes. A list-like container may still contain | |||
many ``Series``, ``Index`` or 1-dimensional ``np.ndarray``, or alternatively, only scalar values. (:issue:`21950`) | |||
- :meth:`FrozenNDArray.searchsorted` has deprecated the ``v`` parameter in favor of ``value`` (:issue:`14645`) | |||
- :func:`DatetimeIndex.shift` now accepts ``periods`` argument instead of ``n`` for consistency with :func:`Index.shift` and :func:`Series.shift`. Using ``n`` throws a deprecation warning (:issue:`22458`) | |||
- :func:`DatetimeIndex.shift` and :func:`PeriodIndex.shift` now accept ``periods`` argument instead of ``n`` for consistency with :func:`Index.shift` and :func:`Series.shift`. Using ``n`` throws a deprecation warning (:issue:`22458`) |
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 add this issue as well here (this PR number is fine)
pls rebase on master as well |
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.
Sorry about the merge conflict. This looks good.
@jreback all green. |
Thanks! |
git diff upstream/master -u -- "*.py" | flake8 --diff
In order to be consistent with
Index.shift
&Series.shift
&DatetimeIndex.shift
,n
argument was deprecated in favor ofperiods
.