Jon Solow
commited on
Commit
•
4e3fad6
1
Parent(s):
07c9a43
Fix typehints and add scores
Browse files
src/queries/pfr/league_schedule.py
CHANGED
@@ -14,9 +14,9 @@ def get_full_schedule(season_int: str | int) -> pd.DataFrame:
|
|
14 |
|
15 |
def get_season_game_map(
|
16 |
season_int: str | int,
|
17 |
-
) -> tuple[dict[int, dict[str, str | int |
|
18 |
df_schedule = get_full_schedule(season_int)
|
19 |
-
week_team_time_map: dict[int, dict[str, str | int |
|
20 |
k: {} for k in SCHEDULE_WEEK_TO_PLAYOFF_WEEK.values()
|
21 |
}
|
22 |
last_game_week_map: dict[int, pd.Timestamp] = {}
|
@@ -41,6 +41,11 @@ def get_season_game_map(
|
|
41 |
"gametime": game_time,
|
42 |
"opponent": winner_team,
|
43 |
}
|
|
|
|
|
|
|
|
|
|
|
44 |
week_team_time_map[mapped_week][winner_team] = winner_game
|
45 |
week_team_time_map[mapped_week][loser_team] = loser_game
|
46 |
return week_team_time_map, last_game_week_map
|
|
|
14 |
|
15 |
def get_season_game_map(
|
16 |
season_int: str | int,
|
17 |
+
) -> tuple[dict[int, dict[str, dict[str, str | int | pd.Timestamp]]], dict[int, pd.Timestamp]]:
|
18 |
df_schedule = get_full_schedule(season_int)
|
19 |
+
week_team_time_map: dict[int, dict[str, dict[str, str | int | pd.Timestamp]]] = {
|
20 |
k: {} for k in SCHEDULE_WEEK_TO_PLAYOFF_WEEK.values()
|
21 |
}
|
22 |
last_game_week_map: dict[int, pd.Timestamp] = {}
|
|
|
41 |
"gametime": game_time,
|
42 |
"opponent": winner_team,
|
43 |
}
|
44 |
+
if isinstance(row["PtsW"], str) and isinstance(row["PtsL"], str):
|
45 |
+
winner_game["score"] = int(row["PtsW"])
|
46 |
+
winner_game["opponent_score"] = int(row["PtsL"])
|
47 |
+
loser_game["score"] = int(row["PtsL"])
|
48 |
+
loser_game["opponent_score"] = int(row["PtsW"])
|
49 |
week_team_time_map[mapped_week][winner_team] = winner_game
|
50 |
week_team_time_map[mapped_week][loser_team] = loser_game
|
51 |
return week_team_time_map, last_game_week_map
|