Skip to content

Instantly share code, notes, and snippets.

@databyjp
Created February 16, 2022 14:20
Show Gist options
  • Save databyjp/e7db42a9cabcf25da90f9cddc525a934 to your computer and use it in GitHub Desktop.
Save databyjp/e7db42a9cabcf25da90f9cddc525a934 to your computer and use it in GitHub Desktop.
def update_box_scores(box_json_dir="dl_data/box_scores/json"):
"""
Download all box scores from NBA API
:param box_json_dir: Directory to save downloads to
:return:
"""
logger.info("Starting download of game box scores...")
gldf = utils.load_gamelogs()
gldf = gldf.sort_values("gamedate_dt")
gm_ids = gldf["Game_ID"].unique()
for gm_id in gm_ids[::-1]:
fetch_box_score(box_json_dir, gm_id)
logger.info("Finished downloading game box scores...")
return True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment