Skip to content

Commit dd7f567

Browse files
DataOmbudsmanTomAugspurger
authored andcommitted
DOC: update the Index.shift docstring (pandas-dev#20192)
* DOC: updating docstring of Index.shift * Add See Also section to shift * Update link to Series.shift
1 parent 5b0caf4 commit dd7f567

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

pandas/core/indexes/base.py

+10-5
Original file line numberDiff line numberDiff line change
@@ -2256,18 +2256,19 @@ def sortlevel(self, level=None, ascending=True, sort_remaining=None):
22562256
return self.sort_values(return_indexer=True, ascending=ascending)
22572257

22582258
def shift(self, periods=1, freq=None):
2259-
"""Shift index by desired number of time frequency increments.
2259+
"""
2260+
Shift index by desired number of time frequency increments.
22602261
22612262
This method is for shifting the values of datetime-like indexes
22622263
by a specified time increment a given number of times.
22632264
22642265
Parameters
22652266
----------
2266-
periods : int
2267+
periods : int, default 1
22672268
Number of periods (or increments) to shift by,
2268-
can be positive or negative (default is 1).
2269-
freq : pandas.DateOffset, pandas.Timedelta or string
2270-
Frequency increment to shift by (default is None).
2269+
can be positive or negative.
2270+
freq : pandas.DateOffset, pandas.Timedelta or string, optional
2271+
Frequency increment to shift by.
22712272
If None, the index is shifted by its own `freq` attribute.
22722273
Offset aliases are valid strings, e.g., 'D', 'W', 'M' etc.
22732274
@@ -2276,6 +2277,10 @@ def shift(self, periods=1, freq=None):
22762277
pandas.Index
22772278
shifted index
22782279
2280+
See Also
2281+
--------
2282+
Series.shift : Shift values of Series.
2283+
22792284
Examples
22802285
--------
22812286
Put the first 5 month starts of 2011 into an index.

0 commit comments

Comments
 (0)