Exemplo n.º 1
0
def statHelper(player, stat, perfnum, n):
    toret = []
    startperf = max(perfnum - n, 0)
    while startperf < perfnum:
        if stat == "DefRnk":
            toret.append(defense.getDefenseRank(startperf, qb_team_abbreviations[player]))
        else:
            toret.append(qb_stats[player][stat][startperf])
        startperf += 1
    return toret
Exemplo n.º 2
0
def statHelper(player, stat, perfnum, n):
	toret = []
	startperf = max(perfnum-n, 0)
	while startperf < perfnum:
		if stat == 'DefRnk':
			if startperf > 15:
				season = 2014
			else: season = 2013
			# print player, stat, startperf%16, season
			toret.append(defense.getDefenseRank(startperf%16,qb_team_abbreviations[player],season))
		else: toret.append(qb_stats[player][stat][startperf])
		startperf += 1
	return toret
Exemplo n.º 3
0
def make_perfs_bag():
    if DEBUG:
        print "Making the bag of all performances data"
    # change to list of ALL QBs
    for qb in season_long_qbs:
        # will have to change to adjust for ALL QBs
        for perfnum in range(13):
            x = []
            y = []
            for i in the_big_five:
                x.append(statHelper(qb, i, perfnum + 3, 3))
                y.append(qb_stats[qb][i][perfnum + 3])
            qb_perfs.append((x, y))
            tup_1 = statHelper(qb, "DefRnk", perfnum + 3, 3)
            tup_2 = defense.getDefenseRank(perfnum, qb_team_abbreviations[qb])
            qb_perfs_defenses.append((tup_1, tup_2))
    if DEBUG:
        print "Bag filled."
Exemplo n.º 4
0
def make_perfs_bag(qb_input_list):
	if DEBUG: print "Making the bag of all performances data"
	#change to list of ALL QBs
	for qb in qb_input_list:
		# will have to change to adjust for ALL QBs
		for perfnum in range(16*num_seasons-(start_week-1)):
			# print perfnum+look_back
			# print "length is:", len(qb_stats[qb]['Td'])
			if len(qb_stats[qb]['Td']) > perfnum+look_back:
				x = []
				y = []
				for i in the_big_five:
					x.append(statHelper(qb,i,perfnum+look_back,look_back))
					y.append(qb_stats[qb][i][perfnum+look_back])
				qb_perfs.append((x,y))
				tup_1 = statHelper(qb,'DefRnk',perfnum+look_back,look_back)
				if perfnum+look_back > 15: 
					curr_season = 2014
				else: curr_season = 2013
				tup_2 = defense.getDefenseRank(perfnum%16, qb_team_abbreviations[qb],curr_season)
				qb_perfs_defenses.append((tup_1,tup_2))
			# else: print "!"
	if DEBUG: print "Bag filled."