pandas 1.4.2

ParametersReturnsBackRef
corr(self, method: 'str | Callable[[np.ndarray, np.ndarray], float]' = 'pearson', min_periods: 'int' = 1) -> 'DataFrame'

Parameters

method : {'pearson', 'kendall', 'spearman'} or callable

Method of correlation:

min_periods : int, optional

Minimum number of observations required per pair of columns to have a valid result. Currently only available for Pearson and Spearman correlation.

Returns

DataFrame

Correlation matrix.

Compute pairwise correlation of columns, excluding NA/null values.

See Also

DataFrame.corrwith

Compute pairwise correlation with another DataFrame or Series.

Series.corr

Compute the correlation between two Series.

Examples

This example is valid syntax, but we were not able to check execution
>>> def histogram_intersection(a, b):
...  v = np.minimum(a, b).sum().round(decimals=1)
...  return v
... df = pd.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)],
...  columns=['dogs', 'cats'])
... df.corr(method=histogram_intersection) dogs cats dogs 1.0 0.3 cats 0.3 1.0
See :

Back References

The following pages refer to to this document either explicitly or contain code examples using this.

pandas.core.window.rolling.Rolling.corr pandas.core.frame.DataFrame.corrwith pandas.core.window.expanding.Expanding.corr pandas.core.window.ewm.ExponentialMovingWindow.corr

Local connectivity graph

Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.

Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)

SVG is more flexible but power hungry; and does not scale well to 50 + nodes.

All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them


File: /pandas/core/frame.py#9480
type: <class 'function'>
Commit: