James McCool commited on
Commit
eed2a00
·
1 Parent(s): f53ed74

Add matchups formatting to app.py for improved data display

Browse files

- Introduced a new dictionary `matchups_format` for formatting matchup statistics: 'HDCF%', 'o_HDCA%', and 'HDCF_m%'.
- Updated the dataframe display to utilize the new formatting, enhancing the visual representation of matchup data.

Files changed (1) hide show
  1. app.py +3 -1
app.py CHANGED
@@ -40,6 +40,8 @@ percentages_format = {'Shots': '{:.2%}', 'HDCF': '{:.2%}', 'Goals': '{:.2%}', 'A
40
  'L14_Shots': '{:.2%}', 'L14_HDCF': '{:.2%}', 'L14_Goals': '{:.2%}', 'L14_Assists': '{:.2%}',
41
  'L14_Blocks': '{:.2%}', 'Max Goal%': '{:.2%}', 'L14 Max Goal%': '{:.2%}'}
42
 
 
 
43
  @st.cache_resource(ttl = 599)
44
  def init_baselines():
45
  parse_hold = pd.DataFrame(columns=['Line', 'SK1', 'SK2', 'SK3', 'Cost', 'Team Total', 'Shots', 'HDCF', 'Goals', 'Assists', 'Blocks',
@@ -114,7 +116,7 @@ with col1:
114
  with col2:
115
  if split_var1 == 'Slate Matchups':
116
  display_table = matchups
117
- st.dataframe(display_table.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), height=1000, use_container_width = True)
118
  st.download_button(
119
  label="Export Matchups",
120
  data=convert_df_to_csv(display_table),
 
40
  'L14_Shots': '{:.2%}', 'L14_HDCF': '{:.2%}', 'L14_Goals': '{:.2%}', 'L14_Assists': '{:.2%}',
41
  'L14_Blocks': '{:.2%}', 'Max Goal%': '{:.2%}', 'L14 Max Goal%': '{:.2%}'}
42
 
43
+ matchups_format = {'HDCF%': '{:.2%}', 'o_HDCA%': '{:.2%}', 'HDCF_m%': '{:.2%}'}
44
+
45
  @st.cache_resource(ttl = 599)
46
  def init_baselines():
47
  parse_hold = pd.DataFrame(columns=['Line', 'SK1', 'SK2', 'SK3', 'Cost', 'Team Total', 'Shots', 'HDCF', 'Goals', 'Assists', 'Blocks',
 
116
  with col2:
117
  if split_var1 == 'Slate Matchups':
118
  display_table = matchups
119
+ st.dataframe(display_table.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(matchups_format, precision=2), height=1000, use_container_width = True)
120
  st.download_button(
121
  label="Export Matchups",
122
  data=convert_df_to_csv(display_table),