Spaces:
Running
Running
James McCool
commited on
Commit
·
5ae652c
1
Parent(s):
855228a
Add custom formatting for ROO percentage columns in player projection display
Browse files
app.py
CHANGED
@@ -53,6 +53,8 @@ gcservice_account, gcservice_account2, db, NBA_Data = init_conn()
|
|
53 |
dk_columns = ['PG', 'SG', 'SF', 'PF', 'C', 'G', 'F', 'FLEX', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']
|
54 |
fd_columns = ['PG1', 'PG2', 'SG1', 'SG2', 'SF1', 'SF2', 'PF1', 'PF2', 'C1', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']
|
55 |
|
|
|
|
|
56 |
@st.cache_data(ttl=60)
|
57 |
def load_overall_stats():
|
58 |
collection = db["DK_Player_Stats"]
|
@@ -346,7 +348,7 @@ with tab1:
|
|
346 |
st.session_state.display_proj = st.session_state.display_proj
|
347 |
elif pos_var2 != 'All':
|
348 |
st.session_state.display_proj = st.session_state.display_proj[st.session_state.display_proj['Position'].str.contains(pos_var2)]
|
349 |
-
st.dataframe(st.session_state.display_proj.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), height=1000, use_container_width = True)
|
350 |
|
351 |
with display_dl_container_1:
|
352 |
display_dl_container = st.empty()
|
|
|
53 |
dk_columns = ['PG', 'SG', 'SF', 'PF', 'C', 'G', 'F', 'FLEX', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']
|
54 |
fd_columns = ['PG1', 'PG2', 'SG1', 'SG2', 'SF1', 'SF2', 'PF1', 'PF2', 'C1', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']
|
55 |
|
56 |
+
roo_format = {'Top_finish': '{:.2f}%', 'Top_5_finish': '{:.2f}%', 'Top_10_finish': '{:.2f}%', '20+%': '{:.2f}%', '4x%': '{:.2f}%', '5x%': '{:.2f}%', '6x%': '{:.2f}%', 'GPP%': '{:.2f}%'}
|
57 |
+
|
58 |
@st.cache_data(ttl=60)
|
59 |
def load_overall_stats():
|
60 |
collection = db["DK_Player_Stats"]
|
|
|
348 |
st.session_state.display_proj = st.session_state.display_proj
|
349 |
elif pos_var2 != 'All':
|
350 |
st.session_state.display_proj = st.session_state.display_proj[st.session_state.display_proj['Position'].str.contains(pos_var2)]
|
351 |
+
st.dataframe(st.session_state.display_proj.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(roo_format, precision=2), height=1000, use_container_width = True)
|
352 |
|
353 |
with display_dl_container_1:
|
354 |
display_dl_container = st.empty()
|