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

Refactor dataframe display in app.py to set index and reduce height

Browse files

- Updated the display of matchups and marketshares dataframes by setting the index to 'Team' and 'Line', respectively.
- Reduced the height of the displayed dataframes from 1000 to 500 for improved layout and usability.

Files changed (1) hide show
  1. app.py +4 -2
app.py CHANGED
@@ -116,7 +116,8 @@ with col1:
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),
@@ -126,7 +127,8 @@ with col2:
126
  elif split_var1 == 'Line Marketshares':
127
  display_table = overall_ms
128
  display_parsed = display_table[display_table['Line'].str.contains('|'.join(team_split))]
129
- st.dataframe(display_parsed.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), height=1000, use_container_width = True)
 
130
  st.download_button(
131
  label="Export Marketshares",
132
  data=convert_df_to_csv(display_table),
 
116
  with col2:
117
  if split_var1 == 'Slate Matchups':
118
  display_table = matchups
119
+ display_table = display_table.set_index('Team')
120
+ st.dataframe(display_table.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(matchups_format, precision=2), height=500, use_container_width = True)
121
  st.download_button(
122
  label="Export Matchups",
123
  data=convert_df_to_csv(display_table),
 
127
  elif split_var1 == 'Line Marketshares':
128
  display_table = overall_ms
129
  display_parsed = display_table[display_table['Line'].str.contains('|'.join(team_split))]
130
+ display_parsed = display_parsed.set_index('Line')
131
+ st.dataframe(display_parsed.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), height=500, use_container_width = True)
132
  st.download_button(
133
  label="Export Marketshares",
134
  data=convert_df_to_csv(display_table),