James McCool commited on
Commit
4336d9e
·
1 Parent(s): 99a9c2b

Maybe added exposures table

Browse files
Files changed (1) hide show
  1. app.py +26 -1
app.py CHANGED
@@ -298,4 +298,29 @@ with tab2:
298
  elif site_var1 == 'Fanduel':
299
  st.session_state.working_seed = fd_lineups.copy()
300
  if 'data_export_display' in st.session_state:
301
- st.dataframe(st.session_state.data_export_display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), height=1000, use_container_width = True)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
298
  elif site_var1 == 'Fanduel':
299
  st.session_state.working_seed = fd_lineups.copy()
300
  if 'data_export_display' in st.session_state:
301
+ st.dataframe(st.session_state.data_export_display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), height=500, use_container_width = True)
302
+
303
+ with st.container():
304
+ if 'data_export_display' in st.session_state:
305
+ # Get the first 9 columns
306
+ first_9_columns = st.session_state.data_export_display.iloc[:, :9]
307
+
308
+ # Flatten the DataFrame and count unique values
309
+ value_counts = first_9_columns.values.flatten().tolist()
310
+ value_counts = pd.Series(value_counts).value_counts()
311
+
312
+ percentages = (value_counts / lineup_num_var * 100).round(2)
313
+
314
+ # Create a DataFrame with the results
315
+ summary_df = pd.DataFrame({
316
+ 'Player': value_counts.index,
317
+ 'Frequency': value_counts.values,
318
+ 'Percentage': percentages.values
319
+ })
320
+
321
+ # Sort by frequency in descending order
322
+ summary_df = summary_df.sort_values('Frequency', ascending=False)
323
+
324
+ # Display the table
325
+ st.write("Player Frequency Table:")
326
+ st.dataframe(summary_df.style.format({'Percentage': '{:.2f}%'}), height=500, use_container_width=True)