A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://pandas.pydata.org/docs/reference/api/pandas.api.extensions.ExtensionArray.shift.html below:

pandas.api.extensions.ExtensionArray.shift — pandas 2.3.1 documentation

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:
periodsint, default 1

The number of periods to shift. Negative values are allowed for shifting backwards.

fill_valueobject, optional

The scalar value to use for newly introduced missing values. The default is self.dtype.na_value.

Returns:
ExtensionArray

Shifted.

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.

For 2-dimensional ExtensionArrays, we are always shifting along axis=0.

Examples

>>> arr = pd.array([1, 2, 3])
>>> arr.shift(2)
<IntegerArray>
[<NA>, <NA>, 1]
Length: 3, dtype: Int64

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4