Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -39,20 +39,14 @@ gcservice_account = init_conn()
|
|
39 |
dk_player_url = 'https://docs.google.com/spreadsheets/d/1lMLxWdvCnOFBtG9dhM0zv2USuxZbkogI_2jnxFfQVVs/edit#gid=1828092624'
|
40 |
CSV_URL = 'https://docs.google.com/spreadsheets/d/1lMLxWdvCnOFBtG9dhM0zv2USuxZbkogI_2jnxFfQVVs/edit#gid=1828092624'
|
41 |
|
|
|
|
|
|
|
42 |
@st.cache_resource(ttl = 600)
|
43 |
def init_baselines():
|
44 |
sh = gcservice_account.open_by_url(dk_player_url)
|
45 |
worksheet = sh.worksheet('ROO')
|
46 |
raw_display = pd.DataFrame(worksheet.get_all_records())
|
47 |
-
#raw_display["Salary"] = raw_display["Salary"].replace(",", "", regex=True).astype(float)
|
48 |
-
#raw_display['Top_finish'] = raw_display['Top_finish'].str.replace('%', '').astype(float)/100
|
49 |
-
#raw_display['Top_5_finish'] = raw_display['Top_5_finish'].str.replace('%', '').astype(float)/100
|
50 |
-
#raw_display['Top_10_finish'] = raw_display['Top_10_finish'].str.replace('%', '').astype(float)/100
|
51 |
-
#raw_display['100+%'] = raw_display['100+%'].str.replace('%', '').astype(float)/100
|
52 |
-
#raw_display['10x%'] = raw_display['10x%'].str.replace('%', '').astype(float)/100
|
53 |
-
#raw_display['11x%'] = raw_display['11x%'].str.replace('%', '').astype(float)/100
|
54 |
-
#raw_display['12x%'] = raw_display['12x%'].str.replace('%', '').astype(float)/100
|
55 |
-
#raw_display['LevX'] = raw_display['LevX'].str.replace('%', '').astype(float)/100
|
56 |
roo_data = raw_display
|
57 |
|
58 |
worksheet = sh.worksheet('DK_CSV')
|
@@ -94,7 +88,7 @@ with tab1:
|
|
94 |
salaryCut = 0
|
95 |
hold_container = st.empty()
|
96 |
display = hold_display.set_index('Player')
|
97 |
-
st.dataframe(display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
98 |
st.download_button(
|
99 |
label="Export Projections",
|
100 |
data=convert_df_to_csv(display),
|
|
|
39 |
dk_player_url = 'https://docs.google.com/spreadsheets/d/1lMLxWdvCnOFBtG9dhM0zv2USuxZbkogI_2jnxFfQVVs/edit#gid=1828092624'
|
40 |
CSV_URL = 'https://docs.google.com/spreadsheets/d/1lMLxWdvCnOFBtG9dhM0zv2USuxZbkogI_2jnxFfQVVs/edit#gid=1828092624'
|
41 |
|
42 |
+
player_roo_format = {'Top_finish': '{:.2%}','Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}', '100+%': '{:.2%}', '10x%': '{:.2%}', '11x%': '{:.2%}',
|
43 |
+
'12x%': '{:.2%}','LevX': '{:.2%}'}
|
44 |
+
|
45 |
@st.cache_resource(ttl = 600)
|
46 |
def init_baselines():
|
47 |
sh = gcservice_account.open_by_url(dk_player_url)
|
48 |
worksheet = sh.worksheet('ROO')
|
49 |
raw_display = pd.DataFrame(worksheet.get_all_records())
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
roo_data = raw_display
|
51 |
|
52 |
worksheet = sh.worksheet('DK_CSV')
|
|
|
88 |
salaryCut = 0
|
89 |
hold_container = st.empty()
|
90 |
display = hold_display.set_index('Player')
|
91 |
+
st.dataframe(display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), use_container_width = True)
|
92 |
st.download_button(
|
93 |
label="Export Projections",
|
94 |
data=convert_df_to_csv(display),
|