Multichem commited on
Commit
2364c0b
·
1 Parent(s): 13c63bc

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +11 -5
app.py CHANGED
@@ -148,7 +148,7 @@ with tab1:
148
  with tab2:
149
  with st.container():
150
  hold_container = st.empty()
151
- col1, col2, col3 = st.columns([3, 3, 3])
152
  with col1:
153
  if st.button("Load/Reset Data", key='reset1'):
154
  for key in st.session_state.keys():
@@ -177,10 +177,15 @@ with tab2:
177
  with col3:
178
  if proj_file is not None:
179
  player_check = st.selectbox('Select player to create comps', options = proj_dataframe['Player'].unique(), key='dk_player')
 
 
 
 
180
  if st.button('Simulate appropriate pivots'):
181
  with hold_container:
182
 
183
  working_roo = proj_dataframe
 
184
  working_roo.rename(columns={"Minutes Proj": "Minutes_Proj"}, inplace = True)
185
  own_dict = dict(zip(working_roo.Player, working_roo.Own))
186
  min_dict = dict(zip(working_roo.Player, working_roo.Minutes_Proj))
@@ -268,7 +273,11 @@ with tab2:
268
  st.session_state.final_Proj = final_Proj
269
 
270
  hold_container = st.empty()
 
271
  with st.container():
 
 
 
272
  col1, col2 = st.columns([7, 2])
273
  with col1:
274
  if 'display_portfolio' in st.session_state:
@@ -276,7 +285,4 @@ with tab2:
276
 
277
  with col2:
278
  if 'player_freq' in st.session_state:
279
- st.dataframe(st.session_state.player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
280
-
281
- if 'final_Proj' in st.session_state:
282
- st.dataframe(st.session_state.final_Proj.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
 
148
  with tab2:
149
  with st.container():
150
  hold_container = st.empty()
151
+ col1, col2, col3, col4, col5 = st.columns([2, 2, 2, 2, 2])
152
  with col1:
153
  if st.button("Load/Reset Data", key='reset1'):
154
  for key in st.session_state.keys():
 
177
  with col3:
178
  if proj_file is not None:
179
  player_check = st.selectbox('Select player to create comps', options = proj_dataframe['Player'].unique(), key='dk_player')
180
+ with col4:
181
+ if proj_file is not None:
182
+ pos_var_list = st.multiselect('Which positions would you like to include?', options = proj_dataframe['Position'].unique(), key='pos_var_list')
183
+ with col5:
184
  if st.button('Simulate appropriate pivots'):
185
  with hold_container:
186
 
187
  working_roo = proj_dataframe
188
+ working_roo = working_roo[working_roo['Position'].isin(pos_var_list)]
189
  working_roo.rename(columns={"Minutes Proj": "Minutes_Proj"}, inplace = True)
190
  own_dict = dict(zip(working_roo.Player, working_roo.Own))
191
  min_dict = dict(zip(working_roo.Player, working_roo.Minutes_Proj))
 
273
  st.session_state.final_Proj = final_Proj
274
 
275
  hold_container = st.empty()
276
+
277
  with st.container():
278
+ if 'final_Proj' in st.session_state:
279
+ st.dataframe(st.session_state.final_Proj.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
280
+
281
  col1, col2 = st.columns([7, 2])
282
  with col1:
283
  if 'display_portfolio' in st.session_state:
 
285
 
286
  with col2:
287
  if 'player_freq' in st.session_state:
288
+ st.dataframe(st.session_state.player_freq.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)