Standardize formatting with black and apply ruff auto-fixes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
36 lines
900 B
Python
36 lines
900 B
Python
import asyncio
|
|
import datetime
|
|
import sys
|
|
|
|
import pandas as pd
|
|
from db_calls import db_get
|
|
|
|
|
|
async def main(args):
|
|
start_time = datetime.datetime.now()
|
|
print("Pulling in season 9 scoring plays...")
|
|
play_query = await db_get(
|
|
"plays",
|
|
api_ver=3,
|
|
params=[
|
|
("season", 9),
|
|
("s_type", "regular"),
|
|
("limit", 100000),
|
|
("short_output", True),
|
|
],
|
|
)
|
|
p_run_time = datetime.datetime.now() - start_time
|
|
print(
|
|
f'Pulled in {play_query["count"]} total plays in {round(p_run_time.total_seconds())} seconds'
|
|
)
|
|
|
|
s_plays = pd.DataFrame(play_query["plays"])
|
|
print("Built the dataframe\nSaving to csv...")
|
|
|
|
s_plays.to_csv("regular-season-plays.csv", encoding="utf-8", index=False)
|
|
print("Saved to regular-season-plays.csv")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
asyncio.run(main(sys.argv[1:]))
|