def push_new_doubles_ratings(con=None):
"""
recalculates doubles ratings and pushes them to the database
"""
games = pd.read_sql('select * from doubles_game where deleted = 0', con=con)
ratingdf = calculate_doubles_ratings(games)
ratingdf = (ratingdf.reset_index().rename(columns={'index':'alias'})
.drop('level_0', axis=1))
ratingdf.to_sql('doubles_ratings', con=con, if_exists='replace', index=False)
team_ratingdf = calculate_team_ratings(games)
team_ratingdf = (team_ratingdf.reset_index().rename(columns={'index': 'team'})
.drop('level_0', axis=1))
team_ratingdf.to_sql('team_doubles_ratings', con=con, if_exists='replace', index=False)
评论列表
文章目录