# pandas.Series.shift¶

Shift index by desired number of periods with an optional time freq.

When freq is not passed, shift the index without realigning the data. If freq is passed (in this case, the index must be date or datetime, or it will raise a NotImplementedError), the index will be increased using the periods and the freq.

- param periods
- int
Number of periods to shift. Can be positive or negative.

- param freq
- DateOffset, tseries.offsets, timedelta, or str, optional
Offset to use from the tseries module or time rule (e.g. ‘EOM’). If freq is specified then the index values are shifted but the data is not realigned. That is, use freq if you would like to extend the index when shifting and preserve the original data.

- param axis
- {0 or ‘index’, 1 or ‘columns’, None}, default None
Shift direction.

- param fill_value
- object, optional
The scalar value to use for newly introduced missing values. the default depends on the dtype of self. For numeric data,

`np.nan`

is used. For datetime, timedelta, or period data, etc.`NaT`

is used. For extension dtypes,`self.dtype.na_value`

is used.Changed in version 0.24.0.

- return
Series Copy of input object, shifted.

## Limitations¶

Parameters `freq`

and `axis`

are supported only with default values `None`

and `0`

respectively.

## Examples¶

```
import numpy as np
import pandas as pd
from numba import njit
@njit
def series_shift():
series = pd.Series([3, -10, np.nan, 0, 92])
return series.shift()
print(series_shift())
```

```
$ python ./series/series_shift.py
0 NaN
1 3.0
2 -10.0
3 NaN
4 0.0
dtype: float64
```