本文簡要介紹
pyspark.pandas.Series.corr
的用法。用法:
Series.corr(other: pyspark.pandas.series.Series, method: str = 'pearson') → float
計算與
other
係列的相關性,不包括缺失值。- other:Series
- method:{‘pearson’, ‘spearman’}
皮爾遜:標準相關係數
spearman:Spearman 等級相關性
- correlation:浮點數
參數:
返回:
注意:
pandas-on-Spark 和 pandas 之間存在行為差異。
method
參數隻接受 ‘pearson’, ‘spearman’數據不應包含 NaN。 pandas-on-Spark 將返回錯誤。
pandas-on-Spark 不支持以下參數。
min_periods
參數不受支持
例子:
>>> df = ps.DataFrame({'s1': [.2, .0, .6, .2], ... 's2': [.3, .6, .0, .1]}) >>> s1 = df.s1 >>> s2 = df.s2 >>> s1.corr(s2, method='pearson') -0.851064...
>>> s1.corr(s2, method='spearman') -0.948683...
相關用法
- Python pyspark Series.copy用法及代碼示例
- Python pyspark Series.count用法及代碼示例
- Python pyspark Series.combine_first用法及代碼示例
- Python pyspark Series.compare用法及代碼示例
- Python pyspark Series.cumsum用法及代碼示例
- Python pyspark Series.cat.ordered用法及代碼示例
- Python pyspark Series.cat.as_unordered用法及代碼示例
- Python pyspark Series.cummax用法及代碼示例
- Python pyspark Series.cat.set_categories用法及代碼示例
- Python pyspark Series.cummin用法及代碼示例
- Python pyspark Series.cat.rename_categories用法及代碼示例
- Python pyspark Series.cat.as_ordered用法及代碼示例
- Python pyspark Series.cumprod用法及代碼示例
- Python pyspark Series.clip用法及代碼示例
- Python pyspark Series.cat.reorder_categories用法及代碼示例
- Python pyspark Series.cat.remove_categories用法及代碼示例
- Python pyspark Series.cat.add_categories用法及代碼示例
- Python pyspark Series.cat.categories用法及代碼示例
- Python pyspark Series.cat.codes用法及代碼示例
- Python pyspark Series.cat.remove_unused_categories用法及代碼示例
- Python pyspark Series.asof用法及代碼示例
- Python pyspark Series.to_frame用法及代碼示例
- Python pyspark Series.rsub用法及代碼示例
- Python pyspark Series.mod用法及代碼示例
- Python pyspark Series.str.join用法及代碼示例
注:本文由純淨天空篩選整理自spark.apache.org大神的英文原創作品 pyspark.pandas.Series.corr。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。