-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmatching.py
137 lines (99 loc) · 4.85 KB
/
matching.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
import pandas
import csv
# df = pandas.read_csv('data.csv')
# print(df["Name"])
# print(df[1])
# for i in range(1,86):
def main():
matches = []
totalrows = 121
with open('data.csv', newline='') as csvfile:
reader = csv.DictReader(csvfile)
mainReader = reader
print(reader)
dat = list(reader)
for current in dat:
print("a")
score = [0] * totalrows
lookingFor = current['I am looking for']
date = current['My perfect first date is....']
importance = current['What is most important to you in your potential match?']
placeToStudy = current['Favorite place to study on campus?']
fitness = current['How important is fitness to you?']
pineApple = current['Pineapple on pizza? ']
datingApp = current['Do you use dating apps?']
fridayNight = current['Ideal Friday night']
spiritAnimal = current['My spirit animal is ']
favMeal = current['Favorite meal']
social = current['Favorite social media']
gender = current['I am a...']
gender_desired = current['Looking for a...']
it = 0
print("a")
for future in dat:
if future['Paid'] == 'Pending':
continue
# Making sure they are not the same person
if current['Name'] == future["Name"]:
continue
# Matching the genders
if future['I am a...'] != current['Looking for a...']:
continue
if future['Looking for a...'] != current['I am a...']:
continue
if current['I preferred to be matched with...'] == 'Someone in my year':
if current['What year are you?'] == future['What year are you?']:
score[int(future['Index'])] += 5
if future['I am looking for'] == lookingFor:
score[int(future['Index'])] += 3
if future['My perfect first date is....'] == date:
score[int(future['Index'])] += 2
if future['What is most important to you in your potential match?'] == importance:
score[int(future['Index'])] += 1
if future['Favorite place to study on campus?'] == placeToStudy:
score[int(future['Index'])] += 1
if future['Looking for a...'] == fitness:
score[int(future['Index'])] += 1
if future['Pineapple on pizza? '] == pineApple:
score[int(future['Index'])] += 1
if future['Do you use dating apps?'] == datingApp:
score[int(future['Index'])] += 1
if future['Ideal Friday night'] == fridayNight:
score[int(future['Index'])] += 1
if future['My spirit animal is '] == spiritAnimal:
score[int(future['Index'])] += 1
if future['Favorite meal'] == favMeal:
score[int(future['Index'])] += 1
if future['Favorite social media'] == social:
score[int(future['Index'])] += 1
z = sorted(range(len(score)), key=lambda i: score[i])[-3:]
print(z)
if current['By submitting my answers, I agree to Venmo @Bronco-Match. I understand that I will only receive my potential Bronco match and/or detailed results if I pay and that all proceeds go to charity. '] == 'Yes I agree to pay $2 for the name of my match':
matches.append((dat[z[0]]['Name'] +" " + dat[z[0]]['(Optional) Write your social media accounts'],
dat[z[1]]['Name'] + " " +dat[z[1]]['(Optional) Write your social media accounts'],
dat[z[2]]['Name'] + " " + dat[z[2]]['(Optional) Write your social media accounts']))
else:
matches.append([dat[z[0]],dat[z[1]],dat[z[2]]])
# matches.append(score)
print("___________________________________________")
for x in matches:
print(x)
#print(matches[1])
# max_id = matches[4].index(max(matches[4]))
# print("Name", dat[18])
# # print(max_id)
# #print(dat[max_id])
# z = sorted(range(len(matches[18])), key=lambda i: matches[18][i])[-3:]
# print(z)
# print(dat[z[0]])
# print(dat[z[1]])
# print(dat[z[2]]['Name'])
# with open('results.csv', mode='w') as result_csv:
# result_csv = csv.writer(result_csv, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
# result_csv.writeRow([])
# for i in range(totalrows):
# max_id = matches[i].index(max(matches[i]))
# top_3 = sorted(range(len(matches[i])), key=lambda x: matches[i][x])[-3:]
#
if __name__== "__main__" :
main()