DataFrame.corr()方法的主要任务是查找DataFrame中所有列的成对关联。如果存在任何空值,则将自动排除它。
它还会忽略DataFrame中的非数字数据类型列。
DataFrame.count(axis=0, level=None, numeric_only=False)
它返回一个DataFrame相关矩阵。
链接:https://www.learnfk.comhttps://www.learnfk.com/pandas/pandas-dataframe-corr.html
来源:LearnFk无涯教程网
>>>defhistogram_intersection(x, y): ... a = np.minimum(x, y).sum().round(decimals=1) ... return a >>>info = pd.DataFrame([(.6, .2), (.4, .7), (.3, .5), (.5, .2)], ... columns=['Pen', 'Pencil']) >>>info.corr(method=histogram_intersection)
输出:
Pen Pencil Pen 1.0 1.1 Pencil 1.1 1.0
祝学习愉快!(内容编辑有误?请选中要编辑内容 -> 右键 -> 修改 -> 提交!)
Spring Boot与Kubernetes云原生微服务实践 -〔杨波〕