Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
39e0137
1
Parent(s):
7fc57f4
swapped some tabs, made more mobile friendly for market props
Browse files
app.py
CHANGED
|
@@ -141,7 +141,7 @@ all_sim_vars = ['NFL_GAME_PLAYER_PASSING_YARDS', 'NFL_GAME_PLAYER_RUSHING_YARDS'
|
|
| 141 |
pick6_sim_vars = ['Rush + Rec Yards', 'Rush + Rec TDs', 'Passing Yards', 'Passing Attempts', 'Passing TDs', 'Completions', 'Rushing Yards', 'Receptions', 'Receiving Yards']
|
| 142 |
sim_all_hold = pd.DataFrame(columns=['Player', 'Team', 'Book', 'Prop Type', 'Prop', 'Mean_Outcome', 'Imp Over', 'Over%', 'Imp Under', 'Under%', 'Bet?', 'Edge'])
|
| 143 |
|
| 144 |
-
tab1, tab2, tab3, tab4, tab5, tab6, tab7 = st.tabs(["Game Betting Model", "QB Projections", "RB/WR/TE Projections",
|
| 145 |
|
| 146 |
def convert_df_to_csv(df):
|
| 147 |
return df.to_csv().encode('utf-8')
|
|
@@ -180,6 +180,46 @@ with tab1:
|
|
| 180 |
)
|
| 181 |
|
| 182 |
with tab2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 183 |
st.info(t_stamp)
|
| 184 |
if st.button("Reset Data", key='reset2'):
|
| 185 |
st.cache_data.clear()
|
|
@@ -207,7 +247,7 @@ with tab2:
|
|
| 207 |
key='NFL_qb_stats_export',
|
| 208 |
)
|
| 209 |
|
| 210 |
-
with
|
| 211 |
st.info(t_stamp)
|
| 212 |
if st.button("Reset Data", key='reset3'):
|
| 213 |
st.cache_data.clear()
|
|
@@ -235,46 +275,6 @@ with tab3:
|
|
| 235 |
key='NFL_nonqb_stats_export',
|
| 236 |
)
|
| 237 |
|
| 238 |
-
with tab4:
|
| 239 |
-
st.info(t_stamp)
|
| 240 |
-
if st.button("Reset Data", key='reset4'):
|
| 241 |
-
st.cache_data.clear()
|
| 242 |
-
game_model, overall_stats, timestamp, prop_frame, prop_trends, pick_frame, market_props = init_baselines()
|
| 243 |
-
qb_stats = overall_stats[overall_stats['Position'] == 'QB']
|
| 244 |
-
qb_stats = qb_stats.drop_duplicates(subset=['Player', 'Position'])
|
| 245 |
-
non_qb_stats = overall_stats[overall_stats['Position'] != 'QB']
|
| 246 |
-
non_qb_stats = non_qb_stats.drop_duplicates(subset=['Player', 'Position'])
|
| 247 |
-
team_dict = dict(zip(prop_frame['Player'], prop_frame['Team']))
|
| 248 |
-
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 249 |
-
market_type = st.selectbox('Select type of prop are you wanting to view', options = prop_table_options, key = 'market_type_key')
|
| 250 |
-
disp_market = market_props.copy()
|
| 251 |
-
disp_market = disp_market[disp_market['PropType'] == market_type]
|
| 252 |
-
disp_market['No_Vig_Prop'] = disp_market.apply(calculate_no_vig, axis=1)
|
| 253 |
-
fanduel_frame = disp_market[disp_market['OddsType'] == 'FANDUEL']
|
| 254 |
-
fanduel_dict = dict(zip(fanduel_frame['Name'], fanduel_frame['No_Vig_Prop']))
|
| 255 |
-
draftkings_frame = disp_market[disp_market['OddsType'] == 'DRAFTKINGS']
|
| 256 |
-
draftkings_dict = dict(zip(draftkings_frame['Name'], draftkings_frame['No_Vig_Prop']))
|
| 257 |
-
mgm_frame = disp_market[disp_market['OddsType'] == 'MGM']
|
| 258 |
-
mgm_dict = dict(zip(mgm_frame['Name'], mgm_frame['No_Vig_Prop']))
|
| 259 |
-
bet365_frame = disp_market[disp_market['OddsType'] == 'BET_365']
|
| 260 |
-
bet365_dict = dict(zip(bet365_frame['Name'], bet365_frame['No_Vig_Prop']))
|
| 261 |
-
|
| 262 |
-
disp_market['FANDUEL NoVig'] = disp_market['Name'].map(fanduel_dict)
|
| 263 |
-
disp_market['DRAFTKINGS NoVig'] = disp_market['Name'].map(draftkings_dict)
|
| 264 |
-
disp_market['MGM NoVig'] = disp_market['Name'].map(mgm_dict)
|
| 265 |
-
disp_market['BET365 NoVig'] = disp_market['Name'].map(bet365_dict)
|
| 266 |
-
|
| 267 |
-
disp_market = disp_market[['Name', 'Position', 'PropType', 'FANDUEL NoVig', 'DRAFTKINGS NoVig', 'MGM NoVig', 'BET365 NoVig']]
|
| 268 |
-
disp_market = disp_market.drop_duplicates(subset=['Name', 'PropType'], keep='first', ignore_index=True)
|
| 269 |
-
|
| 270 |
-
st.dataframe(disp_market.style.background_gradient(axis=1).background_gradient(cmap='RdYlGn').format(prop_format, precision=2), height = 1000, use_container_width = True)
|
| 271 |
-
st.download_button(
|
| 272 |
-
label="Export Market Props",
|
| 273 |
-
data=convert_df_to_csv(disp_market),
|
| 274 |
-
file_name='NFL_market_props_export.csv',
|
| 275 |
-
mime='text/csv',
|
| 276 |
-
)
|
| 277 |
-
|
| 278 |
with tab5:
|
| 279 |
st.info(t_stamp)
|
| 280 |
if st.button("Reset Data", key='reset5'):
|
|
|
|
| 141 |
pick6_sim_vars = ['Rush + Rec Yards', 'Rush + Rec TDs', 'Passing Yards', 'Passing Attempts', 'Passing TDs', 'Completions', 'Rushing Yards', 'Receptions', 'Receiving Yards']
|
| 142 |
sim_all_hold = pd.DataFrame(columns=['Player', 'Team', 'Book', 'Prop Type', 'Prop', 'Mean_Outcome', 'Imp Over', 'Over%', 'Imp Under', 'Under%', 'Bet?', 'Edge'])
|
| 143 |
|
| 144 |
+
tab1, tab2, tab3, tab4, tab5, tab6, tab7 = st.tabs(["Game Betting Model", 'Prop Market', "QB Projections", "RB/WR/TE Projections", "Player Prop Trends", "Player Prop Simulations", "Stat Specific Simulations"])
|
| 145 |
|
| 146 |
def convert_df_to_csv(df):
|
| 147 |
return df.to_csv().encode('utf-8')
|
|
|
|
| 180 |
)
|
| 181 |
|
| 182 |
with tab2:
|
| 183 |
+
st.info(t_stamp)
|
| 184 |
+
if st.button("Reset Data", key='reset4'):
|
| 185 |
+
st.cache_data.clear()
|
| 186 |
+
game_model, overall_stats, timestamp, prop_frame, prop_trends, pick_frame, market_props = init_baselines()
|
| 187 |
+
qb_stats = overall_stats[overall_stats['Position'] == 'QB']
|
| 188 |
+
qb_stats = qb_stats.drop_duplicates(subset=['Player', 'Position'])
|
| 189 |
+
non_qb_stats = overall_stats[overall_stats['Position'] != 'QB']
|
| 190 |
+
non_qb_stats = non_qb_stats.drop_duplicates(subset=['Player', 'Position'])
|
| 191 |
+
team_dict = dict(zip(prop_frame['Player'], prop_frame['Team']))
|
| 192 |
+
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
| 193 |
+
market_type = st.selectbox('Select type of prop are you wanting to view', options = prop_table_options, key = 'market_type_key')
|
| 194 |
+
disp_market = market_props.copy()
|
| 195 |
+
disp_market = disp_market[disp_market['PropType'] == market_type]
|
| 196 |
+
disp_market['No_Vig_Prop'] = disp_market.apply(calculate_no_vig, axis=1)
|
| 197 |
+
fanduel_frame = disp_market[disp_market['OddsType'] == 'FANDUEL']
|
| 198 |
+
fanduel_dict = dict(zip(fanduel_frame['Name'], fanduel_frame['No_Vig_Prop']))
|
| 199 |
+
draftkings_frame = disp_market[disp_market['OddsType'] == 'DRAFTKINGS']
|
| 200 |
+
draftkings_dict = dict(zip(draftkings_frame['Name'], draftkings_frame['No_Vig_Prop']))
|
| 201 |
+
mgm_frame = disp_market[disp_market['OddsType'] == 'MGM']
|
| 202 |
+
mgm_dict = dict(zip(mgm_frame['Name'], mgm_frame['No_Vig_Prop']))
|
| 203 |
+
bet365_frame = disp_market[disp_market['OddsType'] == 'BET_365']
|
| 204 |
+
bet365_dict = dict(zip(bet365_frame['Name'], bet365_frame['No_Vig_Prop']))
|
| 205 |
+
|
| 206 |
+
disp_market['FANDUEL'] = disp_market['Name'].map(fanduel_dict)
|
| 207 |
+
disp_market['DRAFTKINGS'] = disp_market['Name'].map(draftkings_dict)
|
| 208 |
+
disp_market['MGM'] = disp_market['Name'].map(mgm_dict)
|
| 209 |
+
disp_market['BET365'] = disp_market['Name'].map(bet365_dict)
|
| 210 |
+
|
| 211 |
+
disp_market = disp_market[['Name', 'Position','FANDUEL', 'DRAFTKINGS', 'MGM', 'BET365']]
|
| 212 |
+
disp_market = disp_market.drop_duplicates(subset=['Name', 'PropType'], keep='first', ignore_index=True)
|
| 213 |
+
|
| 214 |
+
st.dataframe(disp_market.style.background_gradient(axis=1).background_gradient(cmap='RdYlGn').format(prop_format, precision=2), height = 1000, use_container_width = True)
|
| 215 |
+
st.download_button(
|
| 216 |
+
label="Export Market Props",
|
| 217 |
+
data=convert_df_to_csv(disp_market),
|
| 218 |
+
file_name='NFL_market_props_export.csv',
|
| 219 |
+
mime='text/csv',
|
| 220 |
+
)
|
| 221 |
+
|
| 222 |
+
with tab3:
|
| 223 |
st.info(t_stamp)
|
| 224 |
if st.button("Reset Data", key='reset2'):
|
| 225 |
st.cache_data.clear()
|
|
|
|
| 247 |
key='NFL_qb_stats_export',
|
| 248 |
)
|
| 249 |
|
| 250 |
+
with tab4:
|
| 251 |
st.info(t_stamp)
|
| 252 |
if st.button("Reset Data", key='reset3'):
|
| 253 |
st.cache_data.clear()
|
|
|
|
| 275 |
key='NFL_nonqb_stats_export',
|
| 276 |
)
|
| 277 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
with tab5:
|
| 279 |
st.info(t_stamp)
|
| 280 |
if st.button("Reset Data", key='reset5'):
|