You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
16 lines
575 B
16 lines
575 B
# -*- coding: utf-8 -*-
|
|
|
|
###############################################################################
|
|
####################### 任务实现 #######################
|
|
###############################################################################
|
|
|
|
# 代码 8-1
|
|
import numpy as np
|
|
import pandas as pd
|
|
# inputfile = '../data/data.csv' ## 输入的数据文件
|
|
inputfile = './data.csv' ## 输入的数据文件
|
|
data = pd.read_csv(inputfile) ## 读取数据
|
|
## 保留两位小数
|
|
print('相关系数矩阵为:',np.round(data.corr(method = 'pearson'), 2))
|
|
|