Update functions/pitch_summary_functions.py
Browse files
functions/pitch_summary_functions.py
CHANGED
|
@@ -1055,7 +1055,8 @@ def stat_summary_table(df: pl.DataFrame,
|
|
| 1055 |
player_input: int,
|
| 1056 |
sport_id: int,
|
| 1057 |
ax: plt.Axes,
|
| 1058 |
-
split: str = 'All'
|
|
|
|
| 1059 |
"""
|
| 1060 |
Create a summary table of player statistics.
|
| 1061 |
|
|
@@ -1079,9 +1080,11 @@ def stat_summary_table(df: pl.DataFrame,
|
|
| 1079 |
# Determine app context based on sport ID
|
| 1080 |
appContext = 'majorLeague' if sport_id == 1 else 'minorLeague'
|
| 1081 |
|
|
|
|
|
|
|
| 1082 |
# Fetch player stats from MLB API
|
| 1083 |
pitcher_stats_call = requests.get(
|
| 1084 |
-
f'https://statsapi.mlb.com/api/v1/people/{player_input}?appContext={appContext}&hydrate=stats(group=[pitching],type=[byDateRange],sportId={sport_id},startDate={start_date_format},endDate={end_date_format})'
|
| 1085 |
).json()
|
| 1086 |
|
| 1087 |
# Extract stats and create DataFrame
|
|
|
|
| 1055 |
player_input: int,
|
| 1056 |
sport_id: int,
|
| 1057 |
ax: plt.Axes,
|
| 1058 |
+
split: str = 'All',
|
| 1059 |
+
game_type: list = ['R']):
|
| 1060 |
"""
|
| 1061 |
Create a summary table of player statistics.
|
| 1062 |
|
|
|
|
| 1080 |
# Determine app context based on sport ID
|
| 1081 |
appContext = 'majorLeague' if sport_id == 1 else 'minorLeague'
|
| 1082 |
|
| 1083 |
+
game_type_str = ','.join([str(x) for x in game_type])
|
| 1084 |
+
|
| 1085 |
# Fetch player stats from MLB API
|
| 1086 |
pitcher_stats_call = requests.get(
|
| 1087 |
+
f'https://statsapi.mlb.com/api/v1/people/{player_input}?appContext={appContext}&hydrate=stats(group=[pitching],type=[byDateRange],sportId={sport_id},startDate={start_date_format},endDate={end_date_format},gameType=[{game_type_str}])'
|
| 1088 |
).json()
|
| 1089 |
|
| 1090 |
# Extract stats and create DataFrame
|