Examples
Series

In [1]:
import numpy as np
import pandas as pd
In [2]:
s = pd.Series([80, 81, 75])
s
Out[2]:
0    80
1    81
2    75
dtype: int64

In [3]:
s.pct_change()
Out[3]:
0         NaN
1    0.012500
2   -0.074074
dtype: float64
In [5]:
s.pct_change(periods=2)
Out[5]:
0       NaN
1       NaN
2   -0.0625
dtype: float64

See the percentage change in a Series where filling NAs with last valid observation forward to next valid.

In [6]:
s = pd.Series([80, 81, None, 75])
s
Out[6]:
0    80.0
1    81.0
2     NaN
3    75.0
dtype: float64
In [7]:
s.pct_change(fill_method='ffill')
Out[7]:
0         NaN
1    0.012500
2    0.000000
3   -0.074074
dtype: float64

DataFrame
Percentage change in French franc, Deutsche Mark, and Italian lira from 2000-01-01 to 2000-03-01.

In [8]:
df = pd.DataFrame({
     'FR': [5.0505, 5.0963, 5.3149],
     'GR': [2.7246, 2.7482, 2.8519],
     'IT': [904.74, 910.01, 960.13]},
     index=['2000-01-01', '2000-02-01', '2000-03-01'])
df
Out[8]:
FR GR IT
2000-01-01 5.0505 2.7246 904.74
2000-02-01 5.0963 2.7482 910.01
2000-03-01 5.3149 2.8519 960.13
In [9]:
df.pct_change()
Out[9]:
FR GR IT
2000-01-01 NaN NaN NaN
2000-02-01 0.009068 0.008662 0.005825
2000-03-01 0.042894 0.037734 0.055076

Percentage of change in GOOG and APPL stock volume. Shows computing the percentage
change between columns.

In [10]:
df = pd.DataFrame({
     '2019': [1869950, 32586265],
     '2018': [1600923, 42912316],
     '2017': [1471819, 42403351]},
     index=['GOOG', 'APPL'])
df
Out[10]:
2019 2018 2017
GOOG 1869950 1600923 1471819
APPL 32586265 42912316 42403351
In [11]:
df.pct_change(axis='columns')
Out[11]:
2019 2018 2017
GOOG NaN -0.143869 -0.080643
APPL NaN 0.316884 -0.011861