def pitching_stats_range(start_dt=None, end_dt=None):
    """
    Get all pitching stats for a set time range. This can be the past week, the 
    month of August, anything. Just supply the start and end date in YYYY-MM-DD 
    format. 
    """
    # ensure valid date strings, perform necessary processing for query
    start_dt, end_dt = sanitize_input(start_dt, end_dt)
    if datetime.datetime.strptime(start_dt, "%Y-%m-%d").year < 2008:
        raise ValueError("Year must be 2008 or later")
    if datetime.datetime.strptime(end_dt, "%Y-%m-%d").year < 2008:
        raise ValueError("Year must be 2008 or later")
    # retrieve html from baseball reference
    soup = get_soup(start_dt, end_dt)
    table = get_table(soup)
    table = table.dropna(how='all') # drop if all columns are NA
    #fix some strange formatting for percentage columns
    table = table.replace('---%', np.nan)
    #make sure these are all numeric
    for column in ['Age', '#days', 'G', 'GS', 'W', 'L', 'SV', 'IP', 'H',
                    'R', 'ER', 'BB', 'SO', 'HR', 'HBP', 'ERA', 'AB', '2B',
                    '3B', 'IBB', 'GDP', 'SF', 'SB', 'CS', 'PO', 'BF', 'Pit',
                    'WHIP', 'BAbip', 'SO9', 'SO/W']:
        table[column] = pd.to_numeric(table[column])
    #convert str(xx%) values to float(0.XX) decimal values
    for column in ['Str', 'StL', 'StS', 'GB/FB', 'LD', 'PU']:
        table[column] = table[column].replace('%','',regex=True).astype('float')/100

    table = table.drop('',1)
    return table
def pitching_stats_range ( start_dt = None , end_dt = None ) : start_dt , end_dt = sanitize_input ( start_dt , end_dt ) if datetime . datetime . strptime ( start_dt , "%Y-%m-%d" ) . year < 2008 : raise ValueError ( "Year must be 2008 or later" ) if datetime . datetime . strptime ( end_dt , "%Y-%m-%d" ) . year < 2008 : raise ValueError ( "Year must be 2008 or later" ) soup = get_soup ( start_dt , end_dt ) table = get_table ( soup ) table = table . dropna ( how = 'all' ) table = table . replace ( '---%' , np . nan ) for column in [ 'Age' , '#days' , 'G' , 'GS' , 'W' , 'L' , 'SV' , 'IP' , 'H' , 'R' , 'ER' , 'BB' , 'SO' , 'HR' , 'HBP' , 'ERA' , 'AB' , '2B' , '3B' , 'IBB' , 'GDP' , 'SF' , 'SB' , 'CS' , 'PO' , 'BF' , 'Pit' , 'WHIP' , 'BAbip' , 'SO9' , 'SO/W' ] : table [ column ] = pd . to_numeric ( table [ column ] ) for column in [ 'Str' , 'StL' , 'StS' , 'GB/FB' , 'LD' , 'PU' ] : table [ column ] = table [ column ] . replace ( '%' , '' , regex = True ) . astype ( 'float' ) / 100 table = table . drop ( '' , 1 ) return table
Get all pitching stats for a set time range. This can be the past week, the 
    month of August, anything. Just supply the start and end date in YYYY-MM-DD 
    format.