用法:
Series.corr(other, method='pearson', min_periods=None)
計算與
other
係列的相關性,不包括缺失值。- other:Series
用於計算相關性的係列。
- method:{‘pearson’, ‘kendall’, ‘spearman’} 或可調用
用於計算相關性的方法:
pearson:標準相關係數
kendall:Kendall Tau 相關係數
spearman:Spearman 等級相關性
可調用:可調用,輸入兩個 1d ndarray 並返回一個浮點數。
警告
請注意,從 corr 返回的矩陣沿對角線將具有 1 並且無論可調用對象的行為如何都是對稱的。
- min_periods:整數,可選
獲得有效結果所需的最少觀察次數。
- 浮點數
與其他的相關性。
參數:
返回:
例子:
>>> def histogram_intersection(a, b): ... v = np.minimum(a, b).sum().round(decimals=1) ... return v >>> s1 = pd.Series([.2, .0, .6, .2]) >>> s2 = pd.Series([.3, .6, .0, .1]) >>> s1.corr(s2, method=histogram_intersection) 0.3
相關用法
- Python pandas.Series.combine_first用法及代碼示例
- Python pandas.Series.convert_dtypes用法及代碼示例
- Python pandas.Series.combine用法及代碼示例
- Python pandas.Series.compare用法及代碼示例
- Python pandas.Series.copy用法及代碼示例
- Python pandas.Series.cov用法及代碼示例
- Python pandas.Series.count用法及代碼示例
- Python pandas.Series.cat.remove_categories用法及代碼示例
- Python pandas.Series.cat用法及代碼示例
- Python pandas.Series.cat.rename_categories用法及代碼示例
- Python pandas.Series.cumsum用法及代碼示例
- Python pandas.Series.cat.add_categories用法及代碼示例
- Python pandas.Series.cumprod用法及代碼示例
- Python pandas.Series.cummin用法及代碼示例
- Python pandas.Series.cummax用法及代碼示例
- Python pandas.Series.clip用法及代碼示例
- Python pandas.Series.cat.remove_unused_categories用法及代碼示例
- Python pandas.Series.add_prefix用法及代碼示例
- Python pandas.Series.map用法及代碼示例
- Python pandas.Series.max用法及代碼示例
注:本文由純淨天空篩選整理自pandas.pydata.org大神的英文原創作品 pandas.Series.corr。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。