-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcorrelation.py
More file actions
37 lines (28 loc) · 686 Bytes
/
correlation.py
File metadata and controls
37 lines (28 loc) · 686 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import csv
import numpy
with open('mrrk.csv', newline='') as f:
reader = csv.reader(f)
fileData = list(reader)
fileData.pop(0)
sz = []
time = []
for i in range(len(fileData)):
size = fileData[i][1]
tim = fileData[i][2]
sz.append(float(size))
time.append(float(tim))
coefficient = numpy.corrcoef(sz, time)
print(round(coefficient[0,1], 1))
with open('cup.csv', newline='') as x:
reader = csv.reader(x)
fileDat = list(reader)
fileDat.pop(0)
mrk = []
time = []
for i in range(len(fileDat)):
marks = fileDat[i][1]
tim = fileDat[i][2]
mrk.append(float(marks))
time.append(float(tim))
coefficient = numpy.corrcoef(mrk, time)
print(round(coefficient[0,1], 1))