Description
The actual implementation of pandas.Index.shift
for a datetime-like index takes a differently named parameter for the number of shifts than the base method.
It should be named periods
, which would also be consistent with the pandas.DataFrame.shift
or pandas.Series.shift
methods. But for a DatetimeIndex it's n
.
See:
https://github.com/pandas-dev/pandas/blob/v0.23.4/pandas/core/indexes/base.py#L2586
vs.
https://github.com/pandas-dev/pandas/blob/v0.23.4/pandas/core/indexes/datetimelike.py#L1021
With a DatetimeIndex, following the documentation leads to a
TypeError: shift() got an unexpected keyword argument 'periods'
If this is somehow intended, then it should be stated so in the docstring for pandas.Index.shift
.
pandas version is 0.23.4