James McCool commited on
Commit
81ad445
·
1 Parent(s): 749d0aa

Add ROI formatting and enhance dataframe display in app.py

Browse files

- Introduced a new formatting dictionary for ROI-related metrics, including 'ROI', 'Total Fees', and 'Total Payout'.
- Updated the dataframe display in the Contest Analysis tab to apply the new formatting and added an additional background gradient for 'EntryCount' and 'Total Fees', improving data visualization.

Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -145,6 +145,7 @@ def highlight_row_condition(row):
145
 
146
  player_exposure_format = {'Exposure Overall': '{:.2%}', 'Exposure Top 1%': '{:.2%}', 'Exposure Top 5%': '{:.2%}', 'Exposure Top 10%': '{:.2%}', 'Exposure Top 20%': '{:.2%}'}
147
  dupe_format = {'uniques%': '{:.2%}', 'under_5%': '{:.2%}', 'under_10%': '{:.2%}'}
 
148
 
149
  st.markdown("""
150
  <style>
@@ -940,7 +941,9 @@ if selected_tab == 'Contest Analysis':
940
  end_ROI_idx = min((st.session_state.ROI_page) * rows_per_page, total_rows)
941
 
942
  st.dataframe(st.session_state['ROI_frame'].iloc[start_ROI_idx:end_ROI_idx].style.
943
- background_gradient(cmap='RdYlGn', subset=['ROI', 'Total Fees', 'Total Payout'], axis=0), hide_index=True)
 
 
944
  st.download_button(label="Download ROI Info", data=st.session_state['ROI_frame'].to_csv(index=False), file_name="ROI_info.csv", mime="text/csv", key='ROI_exp_comp_download')
945
  else:
946
  st.write('No ROI info available')
 
145
 
146
  player_exposure_format = {'Exposure Overall': '{:.2%}', 'Exposure Top 1%': '{:.2%}', 'Exposure Top 5%': '{:.2%}', 'Exposure Top 10%': '{:.2%}', 'Exposure Top 20%': '{:.2%}'}
147
  dupe_format = {'uniques%': '{:.2%}', 'under_5%': '{:.2%}', 'under_10%': '{:.2%}'}
148
+ roi_format = {'ROI': '{:.2%}', 'Total Fees': '{:.2f}', 'Total Payout': '{:.2f}'}
149
 
150
  st.markdown("""
151
  <style>
 
941
  end_ROI_idx = min((st.session_state.ROI_page) * rows_per_page, total_rows)
942
 
943
  st.dataframe(st.session_state['ROI_frame'].iloc[start_ROI_idx:end_ROI_idx].style.
944
+ background_gradient(cmap='RdYlGn', subset=['ROI', 'Total Fees', 'Total Payout'], axis=0).
945
+ background_gradient(cmap='RdYlGn', subset=['EntryCount', 'Total Fees'], axis=0).
946
+ format(roi_format, precision=2), hide_index=True)
947
  st.download_button(label="Download ROI Info", data=st.session_state['ROI_frame'].to_csv(index=False), file_name="ROI_info.csv", mime="text/csv", key='ROI_exp_comp_download')
948
  else:
949
  st.write('No ROI info available')