Update functions/pitch_summary_functions.py
Browse files
functions/pitch_summary_functions.py
CHANGED
|
@@ -1078,6 +1078,12 @@ def stat_summary_table(df: pl.DataFrame,
|
|
| 1078 |
'S':'Spring',
|
| 1079 |
'P':'Playoffs' }
|
| 1080 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1081 |
|
| 1082 |
# Format start and end dates
|
| 1083 |
start_date_format = str(pd.to_datetime(df['game_date'][0]).strftime('%m/%d/%Y'))
|
|
@@ -1112,11 +1118,11 @@ def stat_summary_table(df: pl.DataFrame,
|
|
| 1112 |
if df['game_id'][0] == df['game_id'][-1]:
|
| 1113 |
pitcher_stats_call_df_small = pitcher_stats_call_df.select(['inningsPitched', 'battersFaced', 'earnedRuns', 'hits', 'strikeOuts', 'baseOnBalls', 'hitByPitch', 'homeRuns', 'strikePercentage', 'whiffs'])
|
| 1114 |
new_column_names = ['$\\bf{IP}$', '$\\bf{PA}$', '$\\bf{ER}$', '$\\bf{H}$', '$\\bf{K}$', '$\\bf{BB}$', '$\\bf{HBP}$', '$\\bf{HR}$', '$\\bf{Strike\%}$', '$\\bf{Whiffs}$']
|
| 1115 |
-
title = f'{df["game_date"][0]} vs {df["batter_team"][0]} ({type_dict[game_type[0]]})'
|
| 1116 |
elif sport_id != 1 or game_type[0] in ['S','P']:
|
| 1117 |
pitcher_stats_call_df_small = pitcher_stats_call_df.select(['inningsPitched', 'battersFaced', 'whip', 'era', 'fip', 'k_percent', 'bb_percent', 'k_bb_percent', 'strikePercentage'])
|
| 1118 |
new_column_names = ['$\\bf{IP}$', '$\\bf{PA}$', '$\\bf{WHIP}$', '$\\bf{ERA}$', '$\\bf{FIP}$', '$\\bf{K\%}$', '$\\bf{BB\%}$', '$\\bf{K-BB\%}$', '$\\bf{Strike\%}$']
|
| 1119 |
-
title = f'{df["game_date"][0]} to {df["game_date"][-1]} ({type_dict[game_type[0]]})'
|
| 1120 |
else:
|
| 1121 |
fangraphs_table(df=df, ax=ax, player_input=player_input, season=int(df['game_date'][0][0:4]), split=split)
|
| 1122 |
return
|
|
|
|
| 1078 |
'S':'Spring',
|
| 1079 |
'P':'Playoffs' }
|
| 1080 |
|
| 1081 |
+
split_title = {
|
| 1082 |
+
'All':''
|
| 1083 |
+
'RHH':' vs RHH'
|
| 1084 |
+
'LHH':' vs LHH'
|
| 1085 |
+
}
|
| 1086 |
+
|
| 1087 |
|
| 1088 |
# Format start and end dates
|
| 1089 |
start_date_format = str(pd.to_datetime(df['game_date'][0]).strftime('%m/%d/%Y'))
|
|
|
|
| 1118 |
if df['game_id'][0] == df['game_id'][-1]:
|
| 1119 |
pitcher_stats_call_df_small = pitcher_stats_call_df.select(['inningsPitched', 'battersFaced', 'earnedRuns', 'hits', 'strikeOuts', 'baseOnBalls', 'hitByPitch', 'homeRuns', 'strikePercentage', 'whiffs'])
|
| 1120 |
new_column_names = ['$\\bf{IP}$', '$\\bf{PA}$', '$\\bf{ER}$', '$\\bf{H}$', '$\\bf{K}$', '$\\bf{BB}$', '$\\bf{HBP}$', '$\\bf{HR}$', '$\\bf{Strike\%}$', '$\\bf{Whiffs}$']
|
| 1121 |
+
title = f'{df["game_date"][0]} vs {df["batter_team"][0]} ({type_dict[game_type[0]]}){split_title[split]}'
|
| 1122 |
elif sport_id != 1 or game_type[0] in ['S','P']:
|
| 1123 |
pitcher_stats_call_df_small = pitcher_stats_call_df.select(['inningsPitched', 'battersFaced', 'whip', 'era', 'fip', 'k_percent', 'bb_percent', 'k_bb_percent', 'strikePercentage'])
|
| 1124 |
new_column_names = ['$\\bf{IP}$', '$\\bf{PA}$', '$\\bf{WHIP}$', '$\\bf{ERA}$', '$\\bf{FIP}$', '$\\bf{K\%}$', '$\\bf{BB\%}$', '$\\bf{K-BB\%}$', '$\\bf{Strike\%}$']
|
| 1125 |
+
title = f'{df["game_date"][0]} to {df["game_date"][-1]} ({type_dict[game_type[0]]}{split_title[split]})'
|
| 1126 |
else:
|
| 1127 |
fangraphs_table(df=df, ax=ax, player_input=player_input, season=int(df['game_date'][0][0:4]), split=split)
|
| 1128 |
return
|