Пример #1
0
def world_series_logs():
    """
    Pull Retrosheet World Series Game Logs
    """
    file_name = 'GLWS.TXT'
    z = get_zip_file(world_series_url)
    data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"')
    data.columns = gamelog_columns
    return data
Пример #2
0
def wild_card_logs():
    """
    Pull Retrosheet Wild Card Game Logs
    """
    file_name = 'GLWC.TXT'
    z = get_zip_file(wild_card_url)
    data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"')
    data.columns = gamelog_columns
    return data
Пример #3
0
def lcs_logs():
    """
    Pull Retrosheet LCS Game Logs
    """
    file_name = 'GLLC.TXT'
    z = get_zip_file(lcs_url)
    data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"')
    data.columns = gamelog_columns
    return data
Пример #4
0
def all_star_game_logs():
    """
    Pull Retrosheet All Star Game Logs
    """
    file_name = 'GLAS.TXT'
    z = get_zip_file(all_star_url)
    data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"')
    data.columns = gamelog_columns
    return data
Пример #5
0
def season_game_logs(season):
    """
    Pull Retrosheet game logs for a given season
    """
    # validate input
    max_year = int(datetime.now().year) - 1
    if season > max_year or season < 1871:
        raise ValueError('Season must be between 1871 and {}'.format(max_year))
    file_name = 'GL{}.TXT'.format(season)
    z = get_zip_file(gamelog_url.format(season))
    data = pd.read_csv(z.open(file_name), header=None, sep=',', quotechar='"')
    data.columns = gamelog_columns
    return data