pandas 1.4.2

NotesParametersReturns
shift(self, periods=1, fill_value=None, axis=0)

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

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 .

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.

Shift values by desired number.

Examples

See :

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/arrays/_mixins.py#234
type: <class 'function'>
Commit: