Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -43,6 +43,8 @@ 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 |
'Implied Over': '{:.2%}', 'Implied Under': '{:.2%}', 'Over Edge': '{:.2%}', 'Under Edge': '{:.2%}'}
|
45 |
prop_table_options = ['points', 'threes', 'rebounds', 'assists', 'blocks', 'steals', 'PRA', 'PR', 'PA', 'PR']
|
|
|
|
|
46 |
|
47 |
@st.cache_resource(ttl = 300)
|
48 |
def init_baselines():
|
@@ -309,158 +311,250 @@ with tab5:
|
|
309 |
export_container = st.empty()
|
310 |
|
311 |
with col1:
|
312 |
-
prop_type_var = st.selectbox('Select prop category', options = ['points', 'rebounds', 'assists', 'PRA', 'points+rebounds', 'points+assists', 'rebounds+assists'
|
|
|
313 |
|
314 |
if st.button('Simulate Prop Category'):
|
315 |
with col2:
|
316 |
with df_hold_container.container():
|
317 |
-
|
318 |
-
|
319 |
-
|
320 |
-
|
321 |
-
|
322 |
-
|
323 |
-
|
324 |
-
|
325 |
-
|
326 |
-
|
327 |
-
|
328 |
-
|
329 |
-
|
330 |
-
|
331 |
-
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
|
336 |
-
|
337 |
-
|
338 |
-
|
339 |
-
|
340 |
-
|
341 |
-
|
342 |
-
|
343 |
-
|
344 |
-
|
345 |
-
|
346 |
-
|
347 |
-
|
348 |
-
|
349 |
-
|
350 |
-
|
351 |
-
|
352 |
-
|
353 |
-
|
354 |
-
|
355 |
-
|
356 |
-
|
357 |
-
|
358 |
-
|
359 |
-
|
360 |
-
|
361 |
-
|
362 |
-
|
363 |
-
|
364 |
-
|
365 |
-
|
366 |
-
|
367 |
-
|
368 |
-
|
369 |
-
|
370 |
-
|
371 |
-
|
372 |
-
|
373 |
-
|
374 |
-
|
375 |
-
|
376 |
-
|
377 |
-
|
378 |
-
|
379 |
-
|
380 |
-
|
381 |
-
|
382 |
-
|
383 |
-
|
384 |
-
|
385 |
-
|
386 |
-
|
387 |
-
|
388 |
-
|
389 |
-
|
390 |
-
|
391 |
-
|
392 |
-
|
393 |
-
|
394 |
-
|
395 |
-
|
396 |
-
|
397 |
-
|
398 |
-
|
399 |
-
|
400 |
-
|
401 |
-
|
402 |
-
|
403 |
-
|
404 |
-
|
405 |
-
|
406 |
-
|
407 |
-
|
408 |
-
|
409 |
-
|
410 |
-
|
411 |
-
|
412 |
-
|
413 |
-
|
414 |
-
|
415 |
-
|
416 |
-
|
417 |
-
|
418 |
-
|
419 |
-
|
420 |
-
|
421 |
-
|
422 |
-
|
423 |
-
|
424 |
-
|
425 |
-
|
426 |
-
|
427 |
-
|
428 |
-
|
429 |
-
|
430 |
-
|
431 |
-
|
432 |
-
|
433 |
-
|
434 |
-
|
435 |
-
|
436 |
-
|
437 |
-
|
438 |
-
|
439 |
-
|
440 |
-
|
441 |
-
|
442 |
-
|
443 |
-
|
444 |
-
|
445 |
-
|
446 |
-
|
447 |
-
|
448 |
-
|
449 |
-
|
450 |
-
|
451 |
-
|
452 |
-
|
453 |
-
|
454 |
-
|
455 |
-
|
456 |
-
|
457 |
-
|
458 |
-
|
459 |
-
|
460 |
-
|
461 |
-
|
462 |
-
|
463 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
464 |
|
465 |
final_outcomes = final_outcomes.sort_values(by='Edge', ascending=False)
|
466 |
|
|
|
43 |
prop_format = {'L5 Success': '{:.2%}', 'L10_Success': '{:.2%}', 'L20_success': '{:.2%}', 'Matchup Boost': '{:.2%}', 'Trending Over': '{:.2%}', 'Trending Under': '{:.2%}',
|
44 |
'Implied Over': '{:.2%}', 'Implied Under': '{:.2%}', 'Over Edge': '{:.2%}', 'Under Edge': '{:.2%}'}
|
45 |
prop_table_options = ['points', 'threes', 'rebounds', 'assists', 'blocks', 'steals', 'PRA', 'PR', 'PA', 'PR']
|
46 |
+
all_sim_vars = ['points', 'rebounds', 'assists', 'PRA', 'points+rebounds', 'points+assists', 'rebounds+assists']
|
47 |
+
sim_all_hold = pd.DataFrame(columns=['Player', 'Prop', 'Mean_Outcome', 'Imp Over', 'Over%', 'Imp Under', 'Under%', 'Bet?', 'Edge'])
|
48 |
|
49 |
@st.cache_resource(ttl = 300)
|
50 |
def init_baselines():
|
|
|
311 |
export_container = st.empty()
|
312 |
|
313 |
with col1:
|
314 |
+
prop_type_var = st.selectbox('Select prop category', options = ['points', 'rebounds', 'assists', 'PRA', 'points+rebounds', 'points+assists', 'rebounds+assists',
|
315 |
+
'Sim all'])
|
316 |
|
317 |
if st.button('Simulate Prop Category'):
|
318 |
with col2:
|
319 |
with df_hold_container.container():
|
320 |
+
if prop_type_var == 'Sim all':
|
321 |
+
for prop in all_sim_vars:
|
322 |
+
|
323 |
+
prop_df = prop_frame[['Player', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
324 |
+
prop_df = prop_df.loc[prop_df['prop_type'] == prop]
|
325 |
+
prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
|
326 |
+
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
327 |
+
prop_df = prop_df.loc[prop_df['Prop'] != 0]
|
328 |
+
st.table(prop_df)
|
329 |
+
prop_df['Over'] = np.where(prop_df['over_line'] < 0, (-(prop_df['over_line'])/((-(prop_df['over_line']))+101)), 101/(prop_df['over_line']+101))
|
330 |
+
prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+101)), 101/(prop_df['under_line']+101))
|
331 |
+
df = pd.merge(player_stats, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
|
332 |
+
|
333 |
+
prop_dict = dict(zip(df.Player, df.Prop))
|
334 |
+
over_dict = dict(zip(df.Player, df.Over))
|
335 |
+
under_dict = dict(zip(df.Player, df.Under))
|
336 |
+
|
337 |
+
total_sims = 5000
|
338 |
+
|
339 |
+
df.replace("", 0, inplace=True)
|
340 |
+
|
341 |
+
if prop == 'points':
|
342 |
+
df['Median'] = df['Points']
|
343 |
+
elif prop == 'rebounds':
|
344 |
+
df['Median'] = df['Rebounds']
|
345 |
+
elif prop == 'assists':
|
346 |
+
df['Median'] = df['Assists']
|
347 |
+
elif prop == 'PRA':
|
348 |
+
df['Median'] = df['Points'] + df['Rebounds'] + df['Assists']
|
349 |
+
elif prop == 'points+rebounds':
|
350 |
+
df['Median'] = df['Points'] + df['Rebounds']
|
351 |
+
elif prop == 'points+assists':
|
352 |
+
df['Median'] = df['Points'] + df['Assists']
|
353 |
+
elif prop == 'rebounds+assists':
|
354 |
+
df['Median'] = df['Assists'] + df['Rebounds']
|
355 |
+
|
356 |
+
flex_file = df
|
357 |
+
flex_file['Floor'] = (flex_file['Median'] * .25) + (flex_file['Minutes'] * .25)
|
358 |
+
flex_file['Ceiling'] = flex_file['Median'] + 10 + (flex_file['Minutes'] * .25)
|
359 |
+
flex_file['STD'] = (flex_file['Median']/4)
|
360 |
+
flex_file['Prop'] = flex_file['Player'].map(prop_dict)
|
361 |
+
flex_file = flex_file[['Player', 'Prop', 'Floor', 'Median', 'Ceiling', 'STD']]
|
362 |
+
|
363 |
+
hold_file = flex_file
|
364 |
+
overall_file = flex_file
|
365 |
+
prop_file = flex_file
|
366 |
+
|
367 |
+
overall_players = overall_file[['Player']]
|
368 |
+
|
369 |
+
for x in range(0,total_sims):
|
370 |
+
prop_file[x] = prop_file['Prop']
|
371 |
+
|
372 |
+
prop_file = prop_file.drop(['Player', 'Prop', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
|
373 |
+
|
374 |
+
for x in range(0,total_sims):
|
375 |
+
overall_file[x] = np.random.normal(overall_file['Median'],overall_file['STD'])
|
376 |
+
|
377 |
+
overall_file=overall_file.drop(['Player', 'Prop', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
|
378 |
+
|
379 |
+
players_only = hold_file[['Player']]
|
380 |
+
|
381 |
+
player_outcomes = pd.merge(players_only, overall_file, left_index=True, right_index=True)
|
382 |
+
|
383 |
+
prop_check = (overall_file - prop_file)
|
384 |
+
|
385 |
+
players_only['Mean_Outcome'] = overall_file.mean(axis=1)
|
386 |
+
players_only['10%'] = overall_file.quantile(0.1, axis=1)
|
387 |
+
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
388 |
+
players_only['Over'] = prop_check[prop_check > 0].count(axis=1)/float(total_sims)
|
389 |
+
players_only['Imp Over'] = players_only['Player'].map(over_dict)
|
390 |
+
players_only['Over%'] = players_only[["Over", "Imp Over"]].mean(axis=1)
|
391 |
+
players_only['Under'] = prop_check[prop_check < 0].count(axis=1)/float(total_sims)
|
392 |
+
players_only['Imp Under'] = players_only['Player'].map(under_dict)
|
393 |
+
players_only['Under%'] = players_only[["Under", "Imp Under"]].mean(axis=1)
|
394 |
+
players_only['Prop'] = players_only['Player'].map(prop_dict)
|
395 |
+
players_only['Prop_avg'] = players_only['Prop'].mean() / 100
|
396 |
+
players_only['prop_threshold'] = .10
|
397 |
+
players_only = players_only.loc[players_only['Mean_Outcome'] > 0]
|
398 |
+
players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
|
399 |
+
players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
|
400 |
+
players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] , players_only['Under_diff'])
|
401 |
+
players_only['Bet_suggest'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], "Over" , "Under")
|
402 |
+
players_only['Bet?'] = np.where(players_only['Bet_check'] >= players_only['prop_threshold'], players_only['Bet_suggest'], "No Bet")
|
403 |
+
players_only['Edge'] = players_only['Bet_check']
|
404 |
+
|
405 |
+
players_only['Player'] = hold_file[['Player']]
|
406 |
+
|
407 |
+
leg_outcomes = players_only[['Player', 'Prop', 'Mean_Outcome', 'Imp Over', 'Over%', 'Imp Under', 'Under%', 'Bet?', 'Edge']]
|
408 |
+
|
409 |
+
final_outcomes = pd.concat([sim_all_hold, leg_outcomes], ignore_index=True)
|
410 |
+
|
411 |
+
elif prop_type_var != 'Sim all':
|
412 |
+
if prop_type_var == "points":
|
413 |
+
prop_df = prop_frame[['Player', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
414 |
+
prop_df = prop_df.loc[prop_df['prop_type'] == 'points']
|
415 |
+
prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
|
416 |
+
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
417 |
+
prop_df = prop_df.loc[prop_df['Prop'] != 0]
|
418 |
+
st.table(prop_df)
|
419 |
+
prop_df['Over'] = np.where(prop_df['over_line'] < 0, (-(prop_df['over_line'])/((-(prop_df['over_line']))+101)), 101/(prop_df['over_line']+101))
|
420 |
+
prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+101)), 101/(prop_df['under_line']+101))
|
421 |
+
df = pd.merge(player_stats, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
|
422 |
+
elif prop_type_var == "rebounds":
|
423 |
+
prop_df = prop_frame[['Player', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
424 |
+
prop_df = prop_df.loc[prop_df['prop_type'] == 'rebounds']
|
425 |
+
prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
|
426 |
+
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
427 |
+
prop_df = prop_df.loc[prop_df['Prop'] != 0]
|
428 |
+
st.table(prop_df)
|
429 |
+
prop_df['Over'] = np.where(prop_df['over_line'] < 0, (-(prop_df['over_line'])/((-(prop_df['over_line']))+101)), 101/(prop_df['over_line']+101))
|
430 |
+
prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+101)), 101/(prop_df['under_line']+101))
|
431 |
+
df = pd.merge(player_stats, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
|
432 |
+
elif prop_type_var == "assists":
|
433 |
+
prop_df = prop_frame[['Player', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
434 |
+
prop_df = prop_df.loc[prop_df['prop_type'] == 'assists']
|
435 |
+
prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
|
436 |
+
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
437 |
+
prop_df = prop_df.loc[prop_df['Prop'] != 0]
|
438 |
+
st.table(prop_df)
|
439 |
+
prop_df['Over'] = np.where(prop_df['over_line'] < 0, (-(prop_df['over_line'])/((-(prop_df['over_line']))+101)), 101/(prop_df['over_line']+101))
|
440 |
+
prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+101)), 101/(prop_df['under_line']+101))
|
441 |
+
df = pd.merge(player_stats, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
|
442 |
+
elif prop_type_var == "PRA":
|
443 |
+
prop_df = prop_frame[['Player', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
444 |
+
prop_df = prop_df.loc[prop_df['prop_type'] == 'PRA']
|
445 |
+
prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
|
446 |
+
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
447 |
+
prop_df = prop_df.loc[prop_df['Prop'] != 0]
|
448 |
+
st.table(prop_df)
|
449 |
+
prop_df['Over'] = np.where(prop_df['over_line'] < 0, (-(prop_df['over_line'])/((-(prop_df['over_line']))+101)), 101/(prop_df['over_line']+101))
|
450 |
+
prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+101)), 101/(prop_df['under_line']+101))
|
451 |
+
df = pd.merge(player_stats, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
|
452 |
+
elif prop_type_var == "points+rebounds":
|
453 |
+
prop_df = prop_frame[['Player', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
454 |
+
prop_df = prop_df.loc[prop_df['prop_type'] == 'points+rebounds']
|
455 |
+
prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
|
456 |
+
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
457 |
+
prop_df = prop_df.loc[prop_df['Prop'] != 0]
|
458 |
+
st.table(prop_df)
|
459 |
+
prop_df['Over'] = np.where(prop_df['over_line'] < 0, (-(prop_df['over_line'])/((-(prop_df['over_line']))+101)), 101/(prop_df['over_line']+101))
|
460 |
+
prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+101)), 101/(prop_df['under_line']+101))
|
461 |
+
df = pd.merge(player_stats, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
|
462 |
+
elif prop_type_var == "points+assists":
|
463 |
+
prop_df = prop_frame[['Player', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
464 |
+
prop_df = prop_df.loc[prop_df['prop_type'] == 'points+assists']
|
465 |
+
prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
|
466 |
+
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
467 |
+
prop_df = prop_df.loc[prop_df['Prop'] != 0]
|
468 |
+
st.table(prop_df)
|
469 |
+
prop_df['Over'] = np.where(prop_df['over_line'] < 0, (-(prop_df['over_line'])/((-(prop_df['over_line']))+101)), 101/(prop_df['over_line']+101))
|
470 |
+
prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+101)), 101/(prop_df['under_line']+101))
|
471 |
+
df = pd.merge(player_stats, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
|
472 |
+
elif prop_type_var == "rebounds+assists":
|
473 |
+
prop_df = prop_frame[['Player', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
474 |
+
prop_df = prop_df.loc[prop_df['prop_type'] == 'rebounds+assists']
|
475 |
+
prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
|
476 |
+
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
477 |
+
prop_df = prop_df.loc[prop_df['Prop'] != 0]
|
478 |
+
st.table(prop_df)
|
479 |
+
prop_df['Over'] = np.where(prop_df['over_line'] < 0, (-(prop_df['over_line'])/((-(prop_df['over_line']))+101)), 101/(prop_df['over_line']+101))
|
480 |
+
prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+101)), 101/(prop_df['under_line']+101))
|
481 |
+
df = pd.merge(player_stats, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
|
482 |
+
|
483 |
+
prop_dict = dict(zip(df.Player, df.Prop))
|
484 |
+
over_dict = dict(zip(df.Player, df.Over))
|
485 |
+
under_dict = dict(zip(df.Player, df.Under))
|
486 |
+
|
487 |
+
total_sims = 5000
|
488 |
+
|
489 |
+
df.replace("", 0, inplace=True)
|
490 |
+
|
491 |
+
if prop_type_var == 'points':
|
492 |
+
df['Median'] = df['Points']
|
493 |
+
elif prop_type_var == 'rebounds':
|
494 |
+
df['Median'] = df['Rebounds']
|
495 |
+
elif prop_type_var == 'assists':
|
496 |
+
df['Median'] = df['Assists']
|
497 |
+
elif prop_type_var == 'PRA':
|
498 |
+
df['Median'] = df['Points'] + df['Rebounds'] + df['Assists']
|
499 |
+
elif prop_type_var == 'points+rebounds':
|
500 |
+
df['Median'] = df['Points'] + df['Rebounds']
|
501 |
+
elif prop_type_var == 'points+assists':
|
502 |
+
df['Median'] = df['Points'] + df['Assists']
|
503 |
+
elif prop_type_var == 'rebounds+assists':
|
504 |
+
df['Median'] = df['Assists'] + df['Rebounds']
|
505 |
+
|
506 |
+
flex_file = df
|
507 |
+
flex_file['Floor'] = (flex_file['Median'] * .25) + (flex_file['Minutes'] * .25)
|
508 |
+
flex_file['Ceiling'] = flex_file['Median'] + 10 + (flex_file['Minutes'] * .25)
|
509 |
+
flex_file['STD'] = (flex_file['Median']/4)
|
510 |
+
flex_file['Prop'] = flex_file['Player'].map(prop_dict)
|
511 |
+
flex_file = flex_file[['Player', 'Prop', 'Floor', 'Median', 'Ceiling', 'STD']]
|
512 |
+
|
513 |
+
hold_file = flex_file
|
514 |
+
overall_file = flex_file
|
515 |
+
prop_file = flex_file
|
516 |
+
|
517 |
+
overall_players = overall_file[['Player']]
|
518 |
+
|
519 |
+
for x in range(0,total_sims):
|
520 |
+
prop_file[x] = prop_file['Prop']
|
521 |
+
|
522 |
+
prop_file = prop_file.drop(['Player', 'Prop', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
|
523 |
+
|
524 |
+
for x in range(0,total_sims):
|
525 |
+
overall_file[x] = np.random.normal(overall_file['Median'],overall_file['STD'])
|
526 |
+
|
527 |
+
overall_file=overall_file.drop(['Player', 'Prop', 'Floor', 'Median', 'Ceiling', 'STD'], axis=1)
|
528 |
+
|
529 |
+
players_only = hold_file[['Player']]
|
530 |
+
|
531 |
+
player_outcomes = pd.merge(players_only, overall_file, left_index=True, right_index=True)
|
532 |
+
|
533 |
+
prop_check = (overall_file - prop_file)
|
534 |
+
|
535 |
+
players_only['Mean_Outcome'] = overall_file.mean(axis=1)
|
536 |
+
players_only['10%'] = overall_file.quantile(0.1, axis=1)
|
537 |
+
players_only['90%'] = overall_file.quantile(0.9, axis=1)
|
538 |
+
players_only['Over'] = prop_check[prop_check > 0].count(axis=1)/float(total_sims)
|
539 |
+
players_only['Imp Over'] = players_only['Player'].map(over_dict)
|
540 |
+
players_only['Over%'] = players_only[["Over", "Imp Over"]].mean(axis=1)
|
541 |
+
players_only['Under'] = prop_check[prop_check < 0].count(axis=1)/float(total_sims)
|
542 |
+
players_only['Imp Under'] = players_only['Player'].map(under_dict)
|
543 |
+
players_only['Under%'] = players_only[["Under", "Imp Under"]].mean(axis=1)
|
544 |
+
players_only['Prop'] = players_only['Player'].map(prop_dict)
|
545 |
+
players_only['Prop_avg'] = players_only['Prop'].mean() / 100
|
546 |
+
players_only['prop_threshold'] = .10
|
547 |
+
players_only = players_only.loc[players_only['Mean_Outcome'] > 0]
|
548 |
+
players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
|
549 |
+
players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
|
550 |
+
players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] , players_only['Under_diff'])
|
551 |
+
players_only['Bet_suggest'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], "Over" , "Under")
|
552 |
+
players_only['Bet?'] = np.where(players_only['Bet_check'] >= players_only['prop_threshold'], players_only['Bet_suggest'], "No Bet")
|
553 |
+
players_only['Edge'] = players_only['Bet_check']
|
554 |
+
|
555 |
+
players_only['Player'] = hold_file[['Player']]
|
556 |
+
|
557 |
+
final_outcomes = players_only[['Player', 'Prop', 'Mean_Outcome', 'Imp Over', 'Over%', 'Imp Under', 'Under%', 'Bet?', 'Edge']]
|
558 |
|
559 |
final_outcomes = final_outcomes.sort_values(by='Edge', ascending=False)
|
560 |
|