Spaces:
Running
Running
James McCool
commited on
Commit
·
39eff33
1
Parent(s):
b65158e
Enhance app.py to include additional display formats for probability percentages. Updated the 'Over %' and 'Under %' calculations to round to two decimal places and modified the display logic to utilize the new formatting. This change improves clarity and consistency in the displayed data during simulations.
Browse files
app.py
CHANGED
@@ -26,7 +26,7 @@ def init_conn():
|
|
26 |
|
27 |
db, team_names, player_names, min_date, max_date = init_conn()
|
28 |
|
29 |
-
display_formats = {'wKill%': '{:.2%}', 'wDeath%': '{:.2%}', 'wAssist%': '{:.2%}', 'lKill%': '{:.2%}', 'lDeath%': '{:.2%}', 'lAssist%': '{:.2%}'}
|
30 |
leagues = ['AL', 'CBLOL', 'GLL', 'HM', 'LCK', 'LCS', 'LEC', 'LFL', 'LLA', 'LPL', 'LPLOL', 'LVP SL', 'MSI', 'PCS', 'PGN', 'PRM', 'TCL', 'VCS', 'LTAN', 'LTAS',
|
31 |
'LLA', 'LPL', 'LPLOL', 'LVP SL', 'MSI', 'PCS', 'PGN', 'PRM', 'TCL', 'VCS', 'LTAN', 'LTAS']
|
32 |
|
@@ -735,14 +735,14 @@ with tab1:
|
|
735 |
|
736 |
# Prepare display dataframe
|
737 |
st.session_state.display_df = st.session_state.stat_data[['Player', 'Position', 'over_prob', 'under_prob']].copy()
|
738 |
-
st.session_state.display_df['Over %'] = (st.session_state.display_df['over_prob']
|
739 |
-
st.session_state.display_df['Under %'] = (st.session_state.display_df['under_prob']
|
740 |
|
741 |
# Display results
|
742 |
st.dataframe(
|
743 |
st.session_state.display_df[['Player', 'Position', 'Over %', 'Under %']]
|
744 |
.set_index('Player')
|
745 |
-
.style.background_gradient(subset=['Over %', 'Under %'], cmap='RdYlGn'),
|
746 |
use_container_width=True
|
747 |
)
|
748 |
|
|
|
26 |
|
27 |
db, team_names, player_names, min_date, max_date = init_conn()
|
28 |
|
29 |
+
display_formats = {'wKill%': '{:.2%}', 'wDeath%': '{:.2%}', 'wAssist%': '{:.2%}', 'lKill%': '{:.2%}', 'lDeath%': '{:.2%}', 'lAssist%': '{:.2%}', 'Over %': '{:.2%}', 'Under %': '{:.2%}'}
|
30 |
leagues = ['AL', 'CBLOL', 'GLL', 'HM', 'LCK', 'LCS', 'LEC', 'LFL', 'LLA', 'LPL', 'LPLOL', 'LVP SL', 'MSI', 'PCS', 'PGN', 'PRM', 'TCL', 'VCS', 'LTAN', 'LTAS',
|
31 |
'LLA', 'LPL', 'LPLOL', 'LVP SL', 'MSI', 'PCS', 'PGN', 'PRM', 'TCL', 'VCS', 'LTAN', 'LTAS']
|
32 |
|
|
|
735 |
|
736 |
# Prepare display dataframe
|
737 |
st.session_state.display_df = st.session_state.stat_data[['Player', 'Position', 'over_prob', 'under_prob']].copy()
|
738 |
+
st.session_state.display_df['Over %'] = (st.session_state.display_df['over_prob']).round(2)
|
739 |
+
st.session_state.display_df['Under %'] = (st.session_state.display_df['under_prob']).round(2)
|
740 |
|
741 |
# Display results
|
742 |
st.dataframe(
|
743 |
st.session_state.display_df[['Player', 'Position', 'Over %', 'Under %']]
|
744 |
.set_index('Player')
|
745 |
+
.style.background_gradient(subset=['Over %', 'Under %'], cmap='RdYlGn').format(display_formats, precision=2),
|
746 |
use_container_width=True
|
747 |
)
|
748 |
|