Spaces:
Running
Running
James McCool
commited on
Commit
·
f20c215
1
Parent(s):
227e9e2
Add percentage formatting for NBA and MMA dataframes in Streamlit display
Browse files
app.py
CHANGED
|
@@ -20,6 +20,9 @@ from pandas import DataFrame
|
|
| 20 |
from function_hold.NBA_functions import DK_NBA_ROO_Build, FD_NBA_ROO_Build
|
| 21 |
from function_hold.MMA_functions import DK_MMA_ROO_Build, FD_MMA_ROO_Build
|
| 22 |
|
|
|
|
|
|
|
|
|
|
| 23 |
def load_file(upload):
|
| 24 |
if upload is not None:
|
| 25 |
try:
|
|
@@ -122,6 +125,9 @@ with tab2:
|
|
| 122 |
|
| 123 |
try:
|
| 124 |
if 'disp_file' in locals():
|
| 125 |
-
|
|
|
|
|
|
|
|
|
|
| 126 |
except:
|
| 127 |
pass
|
|
|
|
| 20 |
from function_hold.NBA_functions import DK_NBA_ROO_Build, FD_NBA_ROO_Build
|
| 21 |
from function_hold.MMA_functions import DK_MMA_ROO_Build, FD_MMA_ROO_Build
|
| 22 |
|
| 23 |
+
nba_percentages_format = {'Top_finish': '{:.2%}', 'Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}', '20+%': '{:.2%}', '4x%': '{:.2%}', '5x%': '{:.2%}', '6x%': '{:.2%}', 'GPP%': '{:.2%}'}
|
| 24 |
+
mma_percentages_format = {'Top_finish': '{:.2%}', 'Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}', '100+%': '{:.2%}', '10x%': '{:.2%}', '11x%': '{:.2%}', '12x%': '{:.2%}', 'GPP%': '{:.2%}'}
|
| 25 |
+
|
| 26 |
def load_file(upload):
|
| 27 |
if upload is not None:
|
| 28 |
try:
|
|
|
|
| 125 |
|
| 126 |
try:
|
| 127 |
if 'disp_file' in locals():
|
| 128 |
+
if sport_var == "NBA":
|
| 129 |
+
st.dataframe(disp_file.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(nba_percentages_format), height=1000, use_container_width = True)
|
| 130 |
+
elif sport_var == "MMA":
|
| 131 |
+
st.dataframe(disp_file.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(mma_percentages_format), height=1000, use_container_width = True)
|
| 132 |
except:
|
| 133 |
pass
|