pandas.api.typing.DataFrameGroupBy.pct_change

pandas 3.1.1 · GroupBy · method

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

Call syntax

pd.api.typing.DataFrameGroupBy.pct_change(periods=1, fill_method=None, freq=None)

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
str, pandas offset object, or None

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

Returns

Series or DataFrame