pandas 1.4.2

ParametersReturns
shift(self: '_T', periods: 'int' = 1, freq=None) -> '_T'

This method is for shifting the values of datetime-like indexes by a specified time increment a given number of times.

Parameters

periods : int, default 1

Number of periods (or increments) to shift by, can be positive or negative.

freq : pandas.DateOffset, pandas.Timedelta or string, optional

Frequency increment to shift by. If None, the index is shifted by its own :None:None:`freq` attribute. Offset aliases are valid strings, e.g., 'D', 'W', 'M' etc.

Returns

pandas.DatetimeIndex

Shifted index.

Shift index by desired number of time frequency increments.

See Also

Index.shift

Shift values of Index.

PeriodIndex.shift

Shift values of PeriodIndex.

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/indexes/datetimelike.py#327
type: <class 'function'>
Commit: