pandas.api.typing.Window.mean

pandas 3.1.1 · Window operations · method

Average values in each rolling window using its configured weights.

Call syntax

pd.api.typing.Window.mean(numeric_only=False, **kwargs)

Inspect the call

Run this code to inspect the callable and its parameters. Its data, backend, or environment is needed to execute the operation itself.

Parameters

ParameterRequirementAccepted values and behavior
numeric_only Optional
Positional or keyword
Default False
bool

Restrict the calculation to columns pandas considers numeric where applicable.

**kwargs Optional
Additional keyword arguments

Returns

Series or DataFrame

Example for a local Python session

import pandas as pd
import scipy
values = pd.Series([2., 5., 7.], name="units")
window = values.rolling(2, win_type="boxcar")
print(window.mean())