Update functions/pitch_summary_functions.py
Browse files
functions/pitch_summary_functions.py
CHANGED
|
@@ -1086,8 +1086,8 @@ def stat_summary_table(df: pl.DataFrame,
|
|
| 1086 |
|
| 1087 |
|
| 1088 |
# Format start and end dates
|
| 1089 |
-
start_date_format = str(pd.to_datetime(df['game_date'][0])
|
| 1090 |
-
end_date_format = str(pd.to_datetime(df['game_date'][-1])
|
| 1091 |
|
| 1092 |
# Determine app context based on sport ID
|
| 1093 |
appContext = 'majorLeague' if sport_id == 1 else 'minorLeague'
|
|
@@ -1098,6 +1098,7 @@ def stat_summary_table(df: pl.DataFrame,
|
|
| 1098 |
pitcher_stats_call = requests.get(
|
| 1099 |
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}])'
|
| 1100 |
).json()
|
|
|
|
| 1101 |
print(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}])')
|
| 1102 |
# Extract stats and create DataFrame
|
| 1103 |
pitcher_stats_call_header = [x for x in pitcher_stats_call['people'][0]['stats'][0]['splits'][-1]['stat']]
|
|
|
|
| 1086 |
|
| 1087 |
|
| 1088 |
# Format start and end dates
|
| 1089 |
+
start_date_format = str(pd.to_datetime(df['game_date'][0]).strftime('%m/%d/%Y'))
|
| 1090 |
+
end_date_format = str(pd.to_datetime(df['game_date'][-1]).strftime('%m/%d/%Y'))
|
| 1091 |
|
| 1092 |
# Determine app context based on sport ID
|
| 1093 |
appContext = 'majorLeague' if sport_id == 1 else 'minorLeague'
|
|
|
|
| 1098 |
pitcher_stats_call = requests.get(
|
| 1099 |
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}])'
|
| 1100 |
).json()
|
| 1101 |
+
print('HERE')
|
| 1102 |
print(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}])')
|
| 1103 |
# Extract stats and create DataFrame
|
| 1104 |
pitcher_stats_call_header = [x for x in pitcher_stats_call['people'][0]['stats'][0]['splits'][-1]['stat']]
|