Multichem commited on
Commit
dab3604
1 Parent(s): 15d8a95

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -2
app.py CHANGED
@@ -40,6 +40,8 @@ gcservice_account = init_conn()
40
  master_hold = 'https://docs.google.com/spreadsheets/d/1Yq0vGriWK-bS79e-bD6_u9pqrYE6Yrlbb_wEkmH-ot0/edit#gid=853878325'
41
 
42
  game_format = {'Win%': '{:.2%}'}
 
 
43
 
44
  @st.cache_resource(ttl = 300)
45
  def init_baselines():
@@ -73,7 +75,7 @@ def convert_df_to_csv(df):
73
  game_model, player_stats, prop_frame, timestamp = init_baselines()
74
  t_stamp = f"Last Update: " + str(timestamp) + f" CST"
75
 
76
- tab1, tab2, tab3, tab4 = st.tabs(["Game Betting Model", "Player Projections", "Player Prop Simulations", "Stat Specific Simulations"])
77
 
78
  with tab1:
79
  st.info(t_stamp)
@@ -123,6 +125,30 @@ with tab2:
123
  )
124
 
125
  with tab3:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
126
  st.info(t_stamp)
127
  if st.button("Reset Data", key='reset3'):
128
  st.cache_data.clear()
@@ -266,7 +292,7 @@ with tab3:
266
  plot_hold_container = st.empty()
267
  st.plotly_chart(fig, use_container_width=True)
268
 
269
- with tab4:
270
  st.info(t_stamp)
271
  st.info('The Over and Under percentages are a compositve percentage based on simulations, historical performance, and implied probabilities, and may be different than you would expect based purely on the median projection. Likewise, the Edge of a bet is not the only indicator of if you should make the bet or not as the suggestion is using a base acceptable threshold to determine how much edge you should have for each stat category.')
272
  if st.button("Reset Data/Load Data", key='reset5'):
 
40
  master_hold = 'https://docs.google.com/spreadsheets/d/1Yq0vGriWK-bS79e-bD6_u9pqrYE6Yrlbb_wEkmH-ot0/edit#gid=853878325'
41
 
42
  game_format = {'Win%': '{:.2%}'}
43
+ prop_format = {'L5 Success': '{:.2%}', 'L10 Success': '{:.2%}', 'L20 Success': '{:.2%}', 'Matchup Boost': '{:.2%}', 'Trending Over': '{:.2%}', 'Trending Under': '{:.2%}'}
44
+ prop_table_options = ['points', 'threes', 'rebounds', 'assists', 'blocks', 'steals']
45
 
46
  @st.cache_resource(ttl = 300)
47
  def init_baselines():
 
75
  game_model, player_stats, prop_frame, timestamp = init_baselines()
76
  t_stamp = f"Last Update: " + str(timestamp) + f" CST"
77
 
78
+ tab1, tab2, tab3, tab4, tab5 = st.tabs(["Game Betting Model", "Player Projections", "Prop Trend Table", "Player Prop Simulations", "Stat Specific Simulations"])
79
 
80
  with tab1:
81
  st.info(t_stamp)
 
125
  )
126
 
127
  with tab3:
128
+ st.info(t_stamp)
129
+ if st.button("Reset Data", key='reset5'):
130
+ st.cache_data.clear()
131
+ game_model, player_stats, prop_frame, timestamp = init_baselines()
132
+ t_stamp = f"Last Update: " + str(timestamp) + f" CST"
133
+ split_var5 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var5')
134
+ if split_var5 == 'Specific Teams':
135
+ team_var5 = st.multiselect('Which teams would you like to include in the tables?', options = player_stats['Team'].unique(), key='team_var5')
136
+ elif split_var5 == 'All':
137
+ team_var5 = player_stats.Team.values.tolist()
138
+ prop_type_var2 = st.selectbox('Select type of prop to simulate', options = prop_table_options, default = prop_table_options)
139
+ prop_frame = prop_frame[prop_frame['Team'].isin(team_var5)]
140
+ prop_frame = prop_frame[prop_frame['prop_type'].isin(prop_type_var2)]
141
+ prop_frame_disp = prop_frame.set_index('Player')
142
+ prop_frame_disp = prop_frame_disp.sort_values(by='Trending Over', ascending=False)
143
+ st.dataframe(prop_frame_disp.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(prop_format, precision=2), use_container_width = True)
144
+ st.download_button(
145
+ label="Export Prop Trends Model",
146
+ data=convert_df_to_csv(prop_frame),
147
+ file_name='NBA_prop_trends_export.csv',
148
+ mime='text/csv',
149
+ )
150
+
151
+ with tab4:
152
  st.info(t_stamp)
153
  if st.button("Reset Data", key='reset3'):
154
  st.cache_data.clear()
 
292
  plot_hold_container = st.empty()
293
  st.plotly_chart(fig, use_container_width=True)
294
 
295
+ with tab5:
296
  st.info(t_stamp)
297
  st.info('The Over and Under percentages are a compositve percentage based on simulations, historical performance, and implied probabilities, and may be different than you would expect based purely on the median projection. Likewise, the Edge of a bet is not the only indicator of if you should make the bet or not as the suggestion is using a base acceptable threshold to determine how much edge you should have for each stat category.')
298
  if st.button("Reset Data/Load Data", key='reset5'):