-
-
Notifications
You must be signed in to change notification settings - Fork 19.2k
DOC: updating docstring of Index.shift #19996
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 1 commit
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 |
|---|---|---|
|
|
@@ -2211,13 +2211,32 @@ def sortlevel(self, level=None, ascending=True, sort_remaining=None): | |
| return self.sort_values(return_indexer=True, ascending=ascending) | ||
|
|
||
| def shift(self, periods=1, freq=None): | ||
| """ | ||
| Shift Index containing datetime objects by input number of periods and | ||
| DateOffset | ||
| """Shift index by desired number of time frequency increments. | ||
|
|
||
| Returns | ||
| ------- | ||
| shifted : Index | ||
| This method is for shifting the values of datetime-like indexes | ||
| by a specified time increment a given number of times. | ||
|
|
||
| Parameters | ||
| ---------- | ||
| periods : int | ||
| Number of periods (or increments) to shift by, | ||
| can be positive or negative (default is 1). | ||
| freq : pandas.DateOffset, pandas.Timedelta or string | ||
| Frequency increment to shift by (default is None). | ||
| Offset aliases are valid strings, e.g., 'EOM'. | ||
|
|
||
| See Also | ||
| -------- | ||
| DatetimeIndex.shift : an implementation of shift. | ||
| PeriodIndex.shift : an implementation of shift. | ||
| TimedeltaIndex.shift : an implementation of shift. | ||
|
||
|
|
||
| Notes | ||
| ----- | ||
| Must be overridden in child classes. | ||
|
||
| h | ||
| Implemented in datetime-like index classes, | ||
| e.g., DatetimeIndex, PeriodIndex and TimedeltaIndex. | ||
| """ | ||
| raise NotImplementedError("Not supported for type %s" % | ||
| type(self).__name__) | ||
|
|
||
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.
We should explain here what the default of None means.