コード例 #1
0
odds_site = "http://espn.go.com/nba/lines"

team_data1_labels = ['rank','games','wins','losses','win_loss_per','mp','fg','fga','two_p','two_pa','three_p',
                     'three_pa','ft','fta','orb','drb','trb','ast','stl','blk','tov','pf','pts']
team_data2_labels = ['rank','games','wins','losses','win_loss_per','mov','sos','srs','pace','ortg','drtg','efg_per',
                     'tov_per','orb_per','ft_fga','efg_per_opp','tov_per_opp','orb_per_opp','ft_fga_opp']

player_data1_labels = ['rank','age','games','games_started','min_played','fg','fga','two_p','two_pa','three_p',
                       'three_pa','ft','fta','orb','drb','trb','ast','stl','blk','tov','pf','pts','fg_per',
                       'two_p_per','three_p_per','ft_per']
player_data2_labels = ['rank','age','games','games_started','min_played','per','ts_per','efg_per','orb_per','drb_per',
                       'trb_per','ast_per','stl_per','blk_per','tov_per','usg_per','ortg2','drtg2','ows','dws','ws',
                       'ws_48','fg_per','two_p_per','three_p_per','ft_per']

logging.info('Performing Web-scrapes')
team_data1 = Webstats_Funs.get_stats(site=team_site1)
team_data1['update_date'] = today
team_data2 = Webstats_Funs.get_stats(site=team_site2)
team_data2['update_date'] = today
player_data1 = Webstats_Funs.get_stats(site=player_site1, paginate=True)
player_data1['update_date'] = today
player_data2 = Webstats_Funs.get_stats(site=player_site2, paginate=True)
player_data2['update_date'] = today
health_data = Webstats_Funs.get_injury_list(site=health_site)
health_data['update_date'] = today
schedule_data = Webstats_Funs.get_schedule(site=schedule_site)
schedule_data['update_date'] = today
odds_data = Webstats_Funs.get_lines(odds_site)
odds_data['update_date'] = today

######
コード例 #2
0
player_data1_labels = [
    'rank', 'age', 'games', 'games_started', 'min_played', 'fg', 'fga',
    'two_p', 'two_pa', 'three_p', 'three_pa', 'ft', 'fta', 'orb', 'drb', 'trb',
    'ast', 'stl', 'blk', 'tov', 'pf', 'pts', 'fg_per', 'two_p_per',
    'three_p_per', 'ft_per'
]
player_data2_labels = [
    'rank', 'age', 'games', 'games_started', 'min_played', 'per', 'ts_per',
    'efg_per', 'orb_per', 'drb_per', 'trb_per', 'ast_per', 'stl_per',
    'blk_per', 'tov_per', 'usg_per', 'ortg2', 'drtg2', 'ows', 'dws', 'ws',
    'ws_48', 'fg_per', 'two_p_per', 'three_p_per', 'ft_per'
]

logging.info('Performing Web-scrapes')
team_data1 = Webstats_Funs.get_team_stats(site=team_site1,
                                          headers=team_data1_labels)
team_data1['update_date'] = today
team_data2 = Webstats_Funs.get_team_stats(site=team_site2,
                                          headers=team_data2_labels)
team_data2['update_date'] = today
player_data1 = Webstats_Funs.get_player_stats(site=player_site1,
                                              headers=player_data1_labels)
player_data1['update_date'] = today
player_data2 = Webstats_Funs.get_player_stats(site=player_site2,
                                              headers=player_data2_labels)
player_data2['update_date'] = today
health_data = Webstats_Funs.get_injury_list(site=health_site)
health_data['update_date'] = today
schedule_data = Webstats_Funs.get_schedule(site=schedule_site)
schedule_data['update_date'] = today
odds_data = Webstats_Funs.get_lines(odds_site)
コード例 #3
0
odds_site = "http://espn.go.com/nba/lines"

team_data1_labels = ['rank','games','wins','losses','win_loss_per','mp','fg','fga','two_p','two_pa','three_p',
                     'three_pa','ft','fta','orb','drb','trb','ast','stl','blk','tov','pf','pts']
team_data2_labels = ['rank','games','wins','losses','win_loss_per','mov','sos','srs','pace','ortg','drtg','efg_per',
                     'tov_per','orb_per','ft_fga','efg_per_opp','tov_per_opp','orb_per_opp','ft_fga_opp']

player_data1_labels = ['rank','age','games','games_started','min_played','fg','fga','two_p','two_pa','three_p',
                       'three_pa','ft','fta','orb','drb','trb','ast','stl','blk','tov','pf','pts','fg_per',
                       'two_p_per','three_p_per','ft_per']
player_data2_labels = ['rank','age','games','games_started','min_played','per','ts_per','efg_per','orb_per','drb_per',
                       'trb_per','ast_per','stl_per','blk_per','tov_per','usg_per','ortg2','drtg2','ows','dws','ws',
                       'ws_48','fg_per','two_p_per','three_p_per','ft_per']

logging.info('Performing Web-scrapes')
team_data1 = Webstats_Funs.get_team_stats(site=team_site1, headers=team_data1_labels)
team_data1['update_date'] = today
team_data2 = Webstats_Funs.get_team_stats(site=team_site2, headers=team_data2_labels)
team_data2['update_date'] = today
player_data1 = Webstats_Funs.get_player_stats(site=player_site1, headers=player_data1_labels)
player_data1['update_date'] = today
player_data2 = Webstats_Funs.get_player_stats(site=player_site2, headers=player_data2_labels)
player_data2['update_date'] = today
health_data = Webstats_Funs.get_injury_list(site=health_site)
health_data['update_date'] = today
schedule_data = Webstats_Funs.get_schedule(site=schedule_site)
schedule_data['update_date'] = today
odds_data = Webstats_Funs.get_lines(odds_site)
odds_data['update_date'] = today

######
コード例 #4
0
    conn.close()

######
# Set up database connection
nba_data_conn = sqlite3.connect(database_file)

######
# Set up today's information
today = datetime.today().strftime("%Y-%m-%d")
yesterday = datetime.now() - timedelta(days=1)
yesterday = yesterday.strftime("%Y-%m-%d")

######
# Get current lines
odds_site = 'http://espn.go.com/nba/lines'
odds_data = Webstats_Funs.get_lines(odds_site)
odds_data['update_date'] = today
saveFrameToTable(dataFrame=odds_data, tableName='odds_data',
                 sqldbName='NBA_data', dbFolder=data_folder, e_option='append')

######
# Get today's predictions
pred_data_query = 'SELECT * FROM future_schedule WHERE days_ago = 0 AND update_date = \'' + today + '\''
today_pred_data = sql.read_sql(pred_data_query, con=nba_data_conn)

odds_data = odds_data.groupby(['home','visitor']).mean()
odds_data = odds_data.reset_index()

# Do some quick calcs
today_pred_data = today_pred_data.merge(odds_data, on=['home', 'visitor'])
コード例 #5
0
player_data1_labels = [
    'rank', 'age', 'games', 'games_started', 'min_played', 'fg', 'fga',
    'two_p', 'two_pa', 'three_p', 'three_pa', 'ft', 'fta', 'orb', 'drb', 'trb',
    'ast', 'stl', 'blk', 'tov', 'pf', 'pts', 'fg_per', 'two_p_per',
    'three_p_per', 'ft_per'
]
player_data2_labels = [
    'rank', 'age', 'games', 'games_started', 'min_played', 'per', 'ts_per',
    'efg_per', 'orb_per', 'drb_per', 'trb_per', 'ast_per', 'stl_per',
    'blk_per', 'tov_per', 'usg_per', 'ortg2', 'drtg2', 'ows', 'dws', 'ws',
    'ws_48', 'fg_per', 'two_p_per', 'three_p_per', 'ft_per'
]

logging.info('Performing Web-scrapes')
team_data1 = Webstats_Funs.get_stats(site=team_site1)
team_data1['update_date'] = today
team_data2 = Webstats_Funs.get_stats(site=team_site2)
team_data2['update_date'] = today
player_data1 = Webstats_Funs.get_stats(site=player_site1, paginate=True)
player_data1['update_date'] = today
player_data2 = Webstats_Funs.get_stats(site=player_site2, paginate=True)
player_data2['update_date'] = today
health_data = Webstats_Funs.get_injury_list(site=health_site)
health_data['update_date'] = today
schedule_data = Webstats_Funs.get_schedule(site=schedule_site)
schedule_data['update_date'] = today
odds_data = Webstats_Funs.get_lines(odds_site)
odds_data['update_date'] = today

######