pandas.api.typing.DataFrameGroupBy.corr

pandas 3.1.1 · GroupBy · method

Calculate correlation coefficients between numeric inputs. A DataFrame can produce a column-by-column matrix.

Call syntax

pd.api.typing.DataFrameGroupBy.corr(method='pearson', min_periods=1, numeric_only=False)

Run the example

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

Parameters

ParameterRequirementAccepted values and behavior
method Optional
Positional or keyword
Default 'pearson'
{'pearson', 'kendall', 'spearman'} or callable

Choose the algorithm used to calculate, align, or fill the result.

min_periods Optional
Positional or keyword
Default 1
int

Require this many valid observations in a window before pandas reports a value.

numeric_only Optional
Positional or keyword
Default False
bool

Restrict the calculation to columns pandas considers numeric where applicable.

Returns

DataFrame