Python计算相关性

计算相关性

import numpy as np
import pandas as pd

# load data
data = pd.read_csv('result.csv', header=0)
print(data)

df = data.drop(['experiment'], axis=1)

# 计算不同的相关系数
corr = df.corr(method='pearson')
print(corr)

print('\n-----------------------------------------------------------------------------------------------\n')

corr = df.corr(method='spearman')
print(corr)

你可能感兴趣的:(大数据,数据挖掘,Python)