Pandas Series: pct_change() function

Percentage change between the current and a prior element

The pct_change() function is used to get percentage change between the current and a prior element.

Computes the percentage change from the immediately previous row by default. This is useful in comparing the percentage of change in a time series of elements.


Series.pct_change(self, periods=1, fill_method='pad', limit=None, freq=None, **kwargs)
Pandas Series pct_change image


Name Description Type/Default Value Required / Optional
periods Periods to shift for forming percent change. int
Default Value: 1
fill_method How to handle NAs before computing percent changes. str
Default Value: ‘pad’
limit The number of consecutive NAs to fill before stopping. int
Default Value: None
freq Increment to use from time series API (e.g. ‘M’ or BDay()). DateOffset, timedelta, or offset alias string Optional
**kwargs Additional keyword arguments are passed into DataFrame.shift or Series.shift. Required

Returns: chg - Series or DataFrame
The same type as the calling object.


Download the Pandas Series Notebooks from here.

Previous: Get the smallest n elements in Pandas
Next: Product of the values for the requested Pandas axis