vDataFrame.corr¶
In [ ]:
vDataFrame.corr(columns: list = [],
method: str = "pearson",
round_nb: int = 3,
focus: str = "",
show: bool = True,
ax=None,
**style_kwds,)
Computes the correlation matrix of the vDataFrame.
Parameters¶
Name | Type | Optional | Description |
---|---|---|---|
columns | list | ✓ | List of the vcolumns names. If empty, all the numerical vcolumns will be used. |
method | str | ✓ | Method to use to compute the correlation.
|
round_nb | int | ✓ | Rounds the coefficient using the input number of digits. |
focus | bool | ✓ | Focuses computation on only one vcolumn. |
show | bool | ✓ | If true, the correlation matrix will be drawn using Matplotlib. |
ax | Matplotlib axes object | ✓ | The axes to plot on. |
**style_kwds | any | ✓ | Any optional parameter to pass to the Matplotlib functions. |
Returns¶
tablesample : An object containing the result. For more information, see utilities.tablesample.
Example¶
In [18]:
from verticapy.datasets import load_titanic
titanic = load_titanic()
display(titanic)
In [19]:
# Monotonic Correlation
titanic.corr(method = "spearman")
In [20]:
# Categorical correlation
titanic.corr(method = "cramer")
In [21]:
# Linear Correlation using only the response
titanic.corr(method = "pearson", focus = "survived")
See Also¶
vDataFrame.acf | Computes the Correlations between a vcolumn and its lags. |
vDataFrame.corr_pvalue | Computes the Correlation Coefficient of the two input vcolumns and its pvalue. |
vDataFrame.cov | Computes the Covariance Matrix of the vDataFrame. |
vDataFrame.regr | Computes the Regression Matrix of the vDataFrame. |