Esempio n. 1
0
def build_team_file(team):
    filename = FILE_NAME_FORMAT % (team, START_YEAR, END_YEAR)
    with open(filename, 'w') as f:
        f.write('year,' + ','.join(COL_NAMES) + '\n')
        for year in xrange(START_YEAR, END_YEAR+1):
            for season in parse_season_log(team, year, csv=True):
                f.write(season + '\n')
Esempio n. 2
0
def build_master_file():
    filename = 'nfl_masterfile_%s-%s.csv' % (START_YEAR, END_YEAR)
    game_set = set()
    with open(filename, 'w') as f:
        f.write('year,team,' + ','.join(COL_NAMES) + '\n')
        for team, verbose_name in FRANCHISE_DICT.iteritems():
            for year in xrange(START_YEAR, END_YEAR+1):
                try:
                    for season in parse_season_log(
                            team, verbose_name, year, csv=True):
                        print '%s - %s' % (verbose_name, year)
                        f.write(season + '\n')
                except Exception as e:
                    print e
                    pass