Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -199,7 +199,13 @@ with tab2:
|
|
| 199 |
col1, col2 = st.columns([1, 7])
|
| 200 |
with col1:
|
| 201 |
if st.button("Load/Reset Data", key='reset1'):
|
|
|
|
|
|
|
| 202 |
display_portfolio = hold_portfolio
|
|
|
|
|
|
|
|
|
|
|
|
|
| 203 |
hold_container = st.empty()
|
| 204 |
if st.button("Trim Lineups", key='trim1'):
|
| 205 |
max_proj = 10000
|
|
@@ -207,10 +213,8 @@ with tab2:
|
|
| 207 |
x = 0
|
| 208 |
for index, row in display_portfolio.iterrows():
|
| 209 |
if row['Ownership'] > max_own:
|
| 210 |
-
st.write(max_own)
|
| 211 |
display_portfolio.drop(index, inplace=True)
|
| 212 |
elif row['Ownership'] <= max_own:
|
| 213 |
-
st.write(max_own)
|
| 214 |
max_own = row['Ownership']
|
| 215 |
player_check = st.selectbox('Select player to create comps', options = proj_dataframe['Player'].unique(), key='dk_player')
|
| 216 |
if st.button('Simulate appropriate pivots'):
|
|
@@ -301,13 +305,20 @@ with tab2:
|
|
| 301 |
final_Proj = final_Proj[['Player', 'Minutes Proj', 'Position', 'Team', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '20+%', '3x%', '4x%', '5x%', 'GPP%', 'Own', 'LevX', 'ValX']]
|
| 302 |
final_Proj = final_Proj.sort_values(by='Median', ascending=False)
|
| 303 |
final_Proj['Player_swap'] = player_check
|
|
|
|
| 304 |
|
| 305 |
pivot_dict = dict(zip(final_Proj['Player_swap'], final_Proj['Player']))
|
| 306 |
|
| 307 |
hold_container = st.empty()
|
| 308 |
|
| 309 |
with col2:
|
| 310 |
-
with
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 199 |
col1, col2 = st.columns([1, 7])
|
| 200 |
with col1:
|
| 201 |
if st.button("Load/Reset Data", key='reset1'):
|
| 202 |
+
for key in st.session_state.keys():
|
| 203 |
+
del st.session_state[key]
|
| 204 |
display_portfolio = hold_portfolio
|
| 205 |
+
st.session_state.display_portfolio = display_portfolio
|
| 206 |
+
proj_container = st.empty()
|
| 207 |
+
display_container = st.empty()
|
| 208 |
+
display_dl_container = st.empty()
|
| 209 |
hold_container = st.empty()
|
| 210 |
if st.button("Trim Lineups", key='trim1'):
|
| 211 |
max_proj = 10000
|
|
|
|
| 213 |
x = 0
|
| 214 |
for index, row in display_portfolio.iterrows():
|
| 215 |
if row['Ownership'] > max_own:
|
|
|
|
| 216 |
display_portfolio.drop(index, inplace=True)
|
| 217 |
elif row['Ownership'] <= max_own:
|
|
|
|
| 218 |
max_own = row['Ownership']
|
| 219 |
player_check = st.selectbox('Select player to create comps', options = proj_dataframe['Player'].unique(), key='dk_player')
|
| 220 |
if st.button('Simulate appropriate pivots'):
|
|
|
|
| 305 |
final_Proj = final_Proj[['Player', 'Minutes Proj', 'Position', 'Team', 'Salary', 'Floor', 'Median', 'Ceiling', 'Top_finish', 'Top_5_finish', 'Top_10_finish', '20+%', '3x%', '4x%', '5x%', 'GPP%', 'Own', 'LevX', 'ValX']]
|
| 306 |
final_Proj = final_Proj.sort_values(by='Median', ascending=False)
|
| 307 |
final_Proj['Player_swap'] = player_check
|
| 308 |
+
st.session_state.final_Proj = final_Proj
|
| 309 |
|
| 310 |
pivot_dict = dict(zip(final_Proj['Player_swap'], final_Proj['Player']))
|
| 311 |
|
| 312 |
hold_container = st.empty()
|
| 313 |
|
| 314 |
with col2:
|
| 315 |
+
with proj_container:
|
| 316 |
+
proj_container = st.empty()
|
| 317 |
+
if 'display_portfolio' in st.session_state:
|
| 318 |
+
st.dataframe(st.session_state.display_portfolio.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
| 319 |
+
|
| 320 |
+
with display_container:
|
| 321 |
+
display_container = st.empty()
|
| 322 |
+
if 'final_Proj' in st.session_state:
|
| 323 |
+
st.dataframe(st.session_state.final_Proj.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
| 324 |
+
|