On this page
pandas.api.extensions.ExtensionArray.shift
- ExtensionArray.shift(periods=1, fill_value=None)[source]
-
Shift values by desired number.
Newly introduced missing values are filled with
self.dtype.na_value.- Parameters
-
- periods:int, default 1
-
The number of periods to shift. Negative values are allowed for shifting backwards.
- fill_value:object, optional
-
The scalar value to use for newly introduced missing values. The default is
self.dtype.na_value.
- Returns
-
- ExtensionArray
-
Shifted.
Notes
If
selfis empty orperiodsis 0, a copy ofselfis returned.If
periods > len(self), then an array of size len(self) is returned, with all values filled withself.dtype.na_value.
© 2008–2022, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/1.5.0/reference/api/pandas.api.extensions.ExtensionArray.shift.html