maxframe.dataframe.Series.corr#

Series.corr(other, method='pearson', min_periods=None)#

计算与 other Series 的相关性,排除缺失值。

参数:
  • other (Series) -- 用于计算相关性的 Series。

  • method ({'pearson', 'kendall', 'spearman'} or callable) -- 用于计算相关性的方法: - pearson : 标准相关系数 - kendall : Kendall Tau 相关系数 - spearman : Spearman 秩相关系数 - callable: 输入两个一维 ndarray 并返回一个浮点数的可调用对象。 .. note:: kendall、spearman 和可调用对象尚不支持多个 chunk。

  • min_periods (int, optional) -- 获得有效结果所需的最小观测数量。

返回:

与另一个对象的相关性。

返回类型:

float

参见

DataFrame.corr

计算列之间的成对相关性。

DataFrame.corrwith

计算与另一个 DataFrame 或 Series 的成对相关性。

示例

>>> import maxframe.dataframe as md
>>> s1 = md.Series([.2, .0, .6, .2])
>>> s2 = md.Series([.3, .6, .0, .1])
>>> s1.corr(s2, method='pearson').execute()
-0.8510644963469898