def result(): Id = session["match"] Team = teams(Id) Captain = Team[1] VCaptain = Team[2] Team = Team[0] players = [] for i in Team: if i == Captain: x = "(C)" elif i == VCaptain: x = "(VC)" else: x = "" if i == "Nathan Coulter": players.append("Nathan Coulter Nile" + x) elif "Eoin Morgan" in i: players.append("Eoin Morgan" + x) elif "Jason Roy" in i: players.append("Jason Roy" + x) elif "Liam Plunkett" in i: players.append("Liam Plunkett" + x) else: players.append(i[:i.find("\xa0")] + x) c = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] v = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] for i in range(len(players)): if "(C)" in players[i]: c[i] = "(C)" v[i] = "" players[i] = players[i][:-3] elif "(VC)" in players[i]: v[i] = "(VC)" c[i] = "" players[i] = players[i][:-4] else: v[i] = "" c[i] = "" return render_template( "result.html", c1=c[0], v1=v[0], t1=players[0], c2=c[1], v2=v[1], t2=players[1], c3=c[2], v3=v[2], t3=players[2], c4=c[3], v4=v[3], t4=players[3], c5=c[4], v5=v[4], t5=players[4], c6=c[5], v6=v[5], t6=players[5], c7=c[6], v7=v[6], t7=players[6], c8=c[7], v8=v[7], t8=players[7], c9=c[8], v9=v[8], t9=players[8], c10=c[9], v10=v[9], t10=players[9], c11=c[10], v11=v[10], t11=players[10], )
values = {} ID = ["a", "b", "c", "d", "e", "f"] matchname = {} value = [5] for we in ID: name = filename(we) match, matchID, date = ( name.split("%")[0], name.split("%")[1], name.split("%")[2][:-4], ) matchname[we] = match values[match] = {} for k in value: players, captain, vc, wkteam, allteam, ballteam, batteam = teams(we, k) values[match][k] = None teamtotal = 0 for j in players: batscore, ballscore, my11score = 0, 0, 0 f = "" for i in j: if i != "(": f += i else: break f = f.strip() for i in tqdm(os.listdir("data/zip")): if f in i: f = i break
#!/usr/bin/python3 import matplotlib.pyplot as plt import numpy as np import base64 from io import BytesIO import team data = [] teams = team.teams() with open( "/media/cplalexandtang/Windows/Users/cplalexandtang/Desktop/NTU/IDCC2019-Final/data/mlb.csv" ) as file: for line in file.readlines()[:4000]: data.append(line[:-1].split(",")) fig = plt.figure(figsize=(16, 10)) elos = [] for t in teams: elo = [] for d in data: if d[4] == t: elo.append(float(d[6])) if len(elo) == 100: break plt.plot(np.arange(100), np.array(elo), label=t) plt.grid(True) plt.legend()