def shift(<EOL>self,<EOL>periods: int = <NUM_LIT:1>,<EOL>fill_value: object = None,<EOL>) -> ABCExtensionArray:
<EOL>if not len(self) or periods == <NUM_LIT:0>:<EOL><INDENT>return self.copy()<EOL><DEDENT>if isna(fill_value):<EOL><INDENT>fill_value = self.dtype.na_value<EOL><DEDENT>empty = self._from_sequence(<EOL>[fill_value] * min(abs(periods), len(self)),<EOL>dtype=self.dtype<EOL>)<EOL>if periods > <NUM_LIT:0>:<EOL><INDENT>a = empty<EOL>b = self[:-periods]<EOL><DEDENT>else:<EOL><INDENT>a = self[abs(periods):]<EOL>b = empty<EOL><DEDENT>return self._concat_same_type([a, b])<EOL>
Shift values by desired number.

Newly introduced missing values are filled with
``self.dtype.na_value``.

.. versionadded:: 0.24.0

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``

    .. versionadded:: 0.24.0

Returns
-------
shifted : ExtensionArray

Notes
-----
If ``self`` is empty or ``periods`` is 0, a copy of ``self`` is
returned.

If ``periods > len(self)``, then an array of size
len(self) is returned, with all values filled with
``self.dtype.na_value``.