DataFrame.
corr
Compute pairwise correlation of columns, excluding NA/null values.
method ({'pearson', 'kendall', 'spearman'} or callable) –
Method of correlation:
pearson : standard correlation coefficient
kendall : Kendall Tau correlation coefficient
spearman : Spearman rank correlation
and returning a float. Note that the returned matrix from corr will have 1 along the diagonals and will be symmetric regardless of the callable’s behavior.
注解
kendall, spearman and callables not supported on multiple chunks yet.
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.
Correlation matrix.
DataFrame
参见
DataFrame.corrwith
Compute pairwise correlation with another DataFrame or Series.
Series.corr
Compute the correlation between two Series.
实际案例
>>> import mars.dataframe as md >>> df = md.DataFrame([(.2, .3), (.0, .6), (.6, .0), (.2, .1)], ... columns=['dogs', 'cats']) >>> df.corr(method='pearson').execute() dogs cats dogs 1.000000 -0.851064 cats -0.851064 1.000000