Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -71,14 +71,17 @@ def grab_baseline_stuff():
|
|
71 |
|
72 |
worksheet = sh.worksheet('Timestamp')
|
73 |
timestamp = worksheet.acell('A1').value
|
|
|
|
|
|
|
74 |
|
75 |
-
return dk_raw_proj, fd_raw_proj, dk_ids, fd_ids, timestamp
|
76 |
|
77 |
@st.cache_data
|
78 |
def convert_df_to_csv(df):
|
79 |
return df.to_csv().encode('utf-8')
|
80 |
|
81 |
-
dk_raw_proj, fd_raw_proj, dkid_dict, fdid_dict, timestamp = grab_baseline_stuff()
|
82 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
83 |
opp_dict = dict(zip(dk_raw_proj.Team, dk_raw_proj.Opp))
|
84 |
|
@@ -106,7 +109,7 @@ with tab2:
|
|
106 |
st.info(t_stamp)
|
107 |
if st.button("Load/Reset Data", key='reset1'):
|
108 |
st.cache_data.clear()
|
109 |
-
dk_raw_proj, fd_raw_proj, dk_ids, fd_ids, timestamp = grab_baseline_stuff()
|
110 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
111 |
for key in st.session_state.keys():
|
112 |
del st.session_state[key]
|
@@ -170,6 +173,7 @@ with tab2:
|
|
170 |
raw_baselines['lock'] = np.where(raw_baselines['Player'].isin(lock_var1), 1, 0)
|
171 |
st.session_state.export_baselines = raw_baselines.copy()
|
172 |
st.session_state.display_baselines = raw_baselines.copy()
|
|
|
173 |
|
174 |
display_container = st.empty()
|
175 |
display_dl_container = st.empty()
|
@@ -583,7 +587,11 @@ with tab2:
|
|
583 |
with display_container:
|
584 |
display_container = st.empty()
|
585 |
if 'display_baselines' in st.session_state:
|
586 |
-
st.
|
|
|
|
|
|
|
|
|
587 |
|
588 |
with display_dl_container:
|
589 |
display_dl_container = st.empty()
|
|
|
71 |
|
72 |
worksheet = sh.worksheet('Timestamp')
|
73 |
timestamp = worksheet.acell('A1').value
|
74 |
+
|
75 |
+
worksheet = sh.worksheet('Player_Lines_ROO')
|
76 |
+
line_frame = pd.DataFrame(worksheet.get_all_records())
|
77 |
|
78 |
+
return dk_raw_proj, fd_raw_proj, dk_ids, fd_ids, timestamp, line_frame
|
79 |
|
80 |
@st.cache_data
|
81 |
def convert_df_to_csv(df):
|
82 |
return df.to_csv().encode('utf-8')
|
83 |
|
84 |
+
dk_raw_proj, fd_raw_proj, dkid_dict, fdid_dict, timestamp, line_frame = grab_baseline_stuff()
|
85 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
86 |
opp_dict = dict(zip(dk_raw_proj.Team, dk_raw_proj.Opp))
|
87 |
|
|
|
109 |
st.info(t_stamp)
|
110 |
if st.button("Load/Reset Data", key='reset1'):
|
111 |
st.cache_data.clear()
|
112 |
+
dk_raw_proj, fd_raw_proj, dk_ids, fd_ids, timestamp, line_frame = grab_baseline_stuff()
|
113 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
114 |
for key in st.session_state.keys():
|
115 |
del st.session_state[key]
|
|
|
173 |
raw_baselines['lock'] = np.where(raw_baselines['Player'].isin(lock_var1), 1, 0)
|
174 |
st.session_state.export_baselines = raw_baselines.copy()
|
175 |
st.session_state.display_baselines = raw_baselines.copy()
|
176 |
+
st.session_state.display_lines = line_frame.copy()
|
177 |
|
178 |
display_container = st.empty()
|
179 |
display_dl_container = st.empty()
|
|
|
587 |
with display_container:
|
588 |
display_container = st.empty()
|
589 |
if 'display_baselines' in st.session_state:
|
590 |
+
tab1, tab2 = st.tabs(['Line Combo ROO', 'Player Projections'])
|
591 |
+
with tab1:
|
592 |
+
st.dataframe(st.session_state.display_lines.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
593 |
+
with tab2:
|
594 |
+
st.dataframe(st.session_state.display_baselines.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
595 |
|
596 |
with display_dl_container:
|
597 |
display_dl_container = st.empty()
|