-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcycloteam.py
32 lines (22 loc) · 950 Bytes
/
cycloteam.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
import velogames
import cyclingnews
from pprint import pprint
from library import fuzzy_value
def get_initial_data(years):
for year in years:
riders, scores = zip(*list(velogames.rider_table(year, 'tour-de-france')))
results_table = [list() for r in riders]
for event, results in cyclingnews.all_candidate_results(year):
print(event)
for i in range(len(results_table)):
try:
results_table[i].append(results[riders[i]])
except KeyError:
results_table[i].append(999)
yield scores, riders, results_table
all_scores, all_riders, all_results_table = list(), list(), list()
for scores, riders, results_table in get_initial_data([2014, 2015, 2016]):
all_scores.extend(scores)
all_riders.extend(riders)
all_results_table.extend(results_table)
pprint(list(zip(all_scores, all_riders, all_results_table)))