James McCool commited on
Commit
f6ecd24
·
1 Parent(s): 5b393f0

Refactor player ROO data handling in app.py to streamline the display logic by using a local variable for processed data, enhancing readability and maintaining functionality across different view types.

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -324,25 +324,25 @@ with tab2:
324
 
325
  if slate_type_var2 == 'Regular':
326
  try:
327
- st.session_state['player_roo'] = player_roo_raw.drop(columns=['Site', 'Slate', 'pos_group', 'timestamp', 'player_ID'])
328
  except:
329
- st.session_state['player_roo'] = player_roo_raw
330
  elif slate_type_var2 == 'Showdown':
331
  try:
332
- st.session_state['player_roo'] = player_roo_raw.drop(columns=['site', 'slate', 'version', 'timestamp'])
333
  except:
334
- st.session_state['player_roo'] = player_roo_raw
335
  if view_var == "Simple":
336
  try:
337
- st.session_state['player_roo'] = st.session_state['player_roo'][['Player', 'Position', 'Salary', 'Median', 'Ceiling', 'Own']]
338
- st.dataframe(st.session_state['player_roo'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
339
  except:
340
- st.dataframe(st.session_state['player_roo'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
341
  elif view_var == "Advanced":
342
  try:
343
- st.dataframe(st.session_state['player_roo'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
344
  except:
345
- st.dataframe(st.session_state['player_roo'].style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
346
 
347
  with tab3:
348
  st.header("Optimals")
 
324
 
325
  if slate_type_var2 == 'Regular':
326
  try:
327
+ player_roo_disp = player_roo_raw.drop(columns=['Site', 'Slate', 'pos_group', 'timestamp', 'player_ID'])
328
  except:
329
+ player_roo_disp = player_roo_raw
330
  elif slate_type_var2 == 'Showdown':
331
  try:
332
+ player_roo_disp = player_roo_raw.drop(columns=['site', 'slate', 'version', 'timestamp'])
333
  except:
334
+ player_roo_disp = player_roo_raw
335
  if view_var == "Simple":
336
  try:
337
+ player_roo_disp = player_roo_disp[['Player', 'Position', 'Salary', 'Median', 'Ceiling', 'Own']]
338
+ st.dataframe(player_roo_disp.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
339
  except:
340
+ st.dataframe(player_roo_disp.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
341
  elif view_var == "Advanced":
342
  try:
343
+ st.dataframe(player_roo_disp.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
344
  except:
345
+ st.dataframe(player_roo_disp.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True, hide_index=True)
346
 
347
  with tab3:
348
  st.header("Optimals")