James McCool commited on
Commit
8dcbd5a
·
1 Parent(s): f5c8a2c

Implement error handling for dataframe display in Player ROO section of app.py, ensuring fallback to original data in case of column selection failure, thereby enhancing stability and user experience.

Browse files
Files changed (1) hide show
  1. app.py +9 -3
app.py CHANGED
@@ -257,10 +257,16 @@ with tab2:
257
  except:
258
  st.session_state['player_roo'] = player_roo_raw
259
  if view_var == "Simple":
260
- st.session_state['player_roo'] = st.session_state['player_roo'][['Player', 'Position', 'Salary', 'Median', 'Ceiling', 'Own']]
261
- 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)
 
 
 
262
  elif view_var == "Advanced":
263
- 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)
 
 
 
264
 
265
  with tab3:
266
  st.header("Optimals")
 
257
  except:
258
  st.session_state['player_roo'] = player_roo_raw
259
  if view_var == "Simple":
260
+ try:
261
+ st.session_state['player_roo'] = st.session_state['player_roo'][['Player', 'Position', 'Salary', 'Median', 'Ceiling', 'Own']]
262
+ 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)
263
+ except:
264
+ 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)
265
  elif view_var == "Advanced":
266
+ try:
267
+ 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)
268
+ except:
269
+ 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)
270
 
271
  with tab3:
272
  st.header("Optimals")