-
Notifications
You must be signed in to change notification settings - Fork 0
/
ca-visualization-purpose-only.py
117 lines (103 loc) · 3.41 KB
/
ca-visualization-purpose-only.py
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
import pandas as pd
import numpy as np
from scipy.spatial import distance
# dst = distance.euclidean(a, b)
df = pd.read_csv('dataset.csv')
def opennes():
for (index, rec) in df.iterrows():
now = str(rec['o']).split('.')
lst1 = [int(now[0]), int(now[1])]
olst = list()
for (sindex, srec) in df.iterrows():
srec = str(srec['o']).split('.')
lst2 = [int(srec[0]), int(srec[1])]
# print('comparing {} with {}'.format(lst1,lst2))
dst = distance.euclidean(lst1, lst2)
olst.append(dst)
oarray = np.array(olst)
print(oarray)
# temp = np.array(oarray)
# data = temp.mean()
# for t in np.nditer(data):
# print("NOW {}".format(t))
def cons():
for (index, rec) in df.iterrows():
now = str(rec['c']).split('.')
lst1 = [int(now[0]), int(now[1])]
olst = list()
for (sindex, srec) in df.iterrows():
srec = str(srec['c']).split('.')
lst2 = [int(srec[0]), int(srec[1])]
# print('comparing {} with {}'.format(lst1,lst2))
dst = distance.euclidean(lst1, lst2)
olst.append(dst)
oarray = np.array(olst)
print(oarray)
# temp = np.array(oarray)
# data = temp.mean()
# for t in np.nditer(data):
# print("NOW {}".format(t))
def extraversion():
for (index, rec) in df.iterrows():
now = str(rec['e']).split('.')
lst1 = [int(now[0]), int(now[1])]
olst = list()
for (sindex, srec) in df.iterrows():
srec = str(srec['e']).split('.')
lst2 = [int(srec[0]), int(srec[1])]
# print('comparing {} with {}'.format(lst1,lst2))
dst = distance.euclidean(lst1, lst2)
olst.append(dst)
oarray = np.array(olst)
print(oarray)
# temp = np.array(oarray)
# data = temp.mean()
# for t in np.nditer(data):
# print("NOW {}".format(t))
def agree():
for (index, rec) in df.iterrows():
now = str(rec['a']).split('.')
lst1 = [int(now[0]), int(now[1])]
olst = list()
for (sindex, srec) in df.iterrows():
srec = str(srec['a']).split('.')
lst2 = [int(srec[0]), int(srec[1])]
# print('comparing {} with {}'.format(lst1,lst2))
dst = distance.euclidean(lst1, lst2)
olst.append(dst)
oarray = np.array(olst)
print(oarray)
# temp = np.array(oarray)
# data = temp.mean()
# for t in np.nditer(data):
# print("NOW {}".format(t))
def neuro():
for (index, rec) in df.iterrows():
now = str(rec['n']).split('.')
lst1 = [int(now[0]), int(now[1])]
olst = list()
for (sindex, srec) in df.iterrows():
srec = str(srec['n']).split('.')
lst2 = [int(srec[0]), int(srec[1])]
# print('comparing {} with {}'.format(lst1,lst2))
dst = distance.euclidean(lst1, lst2)
olst.append(dst)
oarray = np.array(olst)
print(oarray)
# temp = np.array(oarray)
# data = temp.mean()
# for t in np.nditer(data):
# print("NOW {}".format(t))
print('FINAL RESULTS')
print('\n')
print('Openness')
opennes()
print('\n')
print('Consciousness')
cons()
print('\n')
print('Agreeableness')
agree()
print('\n')
print('Neuroticism')
neuro()