pandas.DataFrame.pct_change

pandas 3.1.1 · DataFrame · method

Compute fractional change from an earlier value. Multiply by 100 to express it as a percentage.

Call syntax

DataFrame.pct_change(periods=1, fill_method=None, freq=None, **kwargs)

Run the example

Edit the example and select Run Python to see the result.

Parameters

ParameterRequirementAccepted values and behavior
periods Optional
Positional or keyword
Default 1
int

Set a count of generated observations or the number of steps to shift or compare.

fill_method Optional
Positional or keyword
Default None
None

Choose how missing values are filled before or during alignment.

freq Optional
Positional or keyword
Default None
DateOffset, timedelta, or str

Specify the frequency or offset, such as "D" for a day or "MS" for a calendar month start.

**kwargs Optional
Additional keyword arguments

Returns

Series or DataFrame