Spaces:
Running
Running
James McCool
commited on
Commit
·
0a29ddd
1
Parent(s):
f725d48
Add game and player ROO formatting options in app.py to enhance dataframe display with percentage formatting, improving data readability and user experience.
Browse files
app.py
CHANGED
@@ -22,6 +22,9 @@ def init_conn():
|
|
22 |
|
23 |
db, db2 = init_conn()
|
24 |
|
|
|
|
|
|
|
25 |
player_roo_format = {'Top_finish': '{:.2%}','Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}', '20+%': '{:.2%}', '2x%': '{:.2%}', '3x%': '{:.2%}',
|
26 |
'4x%': '{:.2%}'}
|
27 |
|
@@ -135,7 +138,7 @@ with tab1:
|
|
135 |
with col4:
|
136 |
own_var1 = st.radio("How would you like to display team ownership?", ('Sum', 'Average'), key='own_var1')
|
137 |
st.title("Scoring Percentages")
|
138 |
-
st.dataframe(scoring_percentages)
|
139 |
|
140 |
with tab2:
|
141 |
st.title("Player ROO")
|
|
|
22 |
|
23 |
db, db2 = init_conn()
|
24 |
|
25 |
+
game_format = {'Win Percentage': '{:.2%}','First Inning Lead Percentage': '{:.2%}',
|
26 |
+
'Fifth Inning Lead Percentage': '{:.2%}', '8+ runs': '{:.2%}', 'DK LevX': '{:.2%}', 'FD LevX': '{:.2%}'}
|
27 |
+
|
28 |
player_roo_format = {'Top_finish': '{:.2%}','Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}', '20+%': '{:.2%}', '2x%': '{:.2%}', '3x%': '{:.2%}',
|
29 |
'4x%': '{:.2%}'}
|
30 |
|
|
|
138 |
with col4:
|
139 |
own_var1 = st.radio("How would you like to display team ownership?", ('Sum', 'Average'), key='own_var1')
|
140 |
st.title("Scoring Percentages")
|
141 |
+
st.dataframe(scoring_percentages.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(game_format, precision=2), height=750, use_container_width = True, hide_index=True)
|
142 |
|
143 |
with tab2:
|
144 |
st.title("Player ROO")
|