Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
e066741
1
Parent(s):
4c34346
cleaned up the stat specific sim
Browse files
app.py
CHANGED
|
@@ -408,35 +408,39 @@ with tab6:
|
|
| 408 |
with df_hold_container.container():
|
| 409 |
if prop_type_var == 'All Props':
|
| 410 |
if game_select_var == 'Aggregate':
|
|
|
|
| 411 |
sim_vars = ['NFL_GAME_PLAYER_PASSING_YARDS', 'NFL_GAME_PLAYER_RUSHING_YARDS', 'NFL_GAME_PLAYER_PASSING_ATTEMPTS', 'NFL_GAME_PLAYER_PASSING_TOUCHDOWNS', 'NFL_GAME_PLAYER_RUSHING_ATTEMPTS',
|
| 412 |
'NFL_GAME_PLAYER_RECEIVING_RECEPTIONS', 'NFL_GAME_PLAYER_RECEIVING_YARDS', 'NFL_GAME_PLAYER_RECEIVING_TOUCHDOWNS']
|
| 413 |
elif game_select_var == 'Pick6':
|
|
|
|
| 414 |
sim_vars = ['Rush + Rec Yards', 'Rush + Rec TDs', 'Passing Yards', 'Passing Attempts', 'Passing TDs', 'Rushing Attempts', 'Rushing Yards', 'Receptions', 'Receiving Yards', 'Receiving TDs']
|
|
|
|
|
|
|
|
|
|
| 415 |
for prop in sim_vars:
|
| 416 |
-
|
| 417 |
-
if game_select_var == 'Aggregate':
|
| 418 |
-
prop_df_raw = prop_frame[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
| 419 |
-
elif game_select_var == 'Pick6':
|
| 420 |
-
prop_df_raw = pick_frame[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
| 421 |
-
|
| 422 |
for books in book_selections:
|
| 423 |
prop_df = prop_df_raw[prop_df_raw['book'] == books]
|
| 424 |
prop_df = prop_df[prop_df['prop_type'] == prop]
|
| 425 |
prop_df = prop_df[~((prop_df['over_prop'] < 15) & (prop_df['prop_type'] == 'NFL_GAME_PLAYER_RUSHING_YARDS'))]
|
| 426 |
prop_df = prop_df[['Player', 'book', 'over_prop', 'over_line', 'under_line']]
|
| 427 |
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
| 428 |
-
prop_df = prop_df.drop_duplicates(subset=['Player'])
|
| 429 |
-
prop_df = prop_df[prop_df['Prop'] != 0]
|
| 430 |
prop_df['Over'] = 1 / prop_df['over_line']
|
| 431 |
prop_df['Under'] = 1 / prop_df['under_line']
|
| 432 |
-
df = pd.merge(overall_stats, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
|
| 433 |
-
df = df.reset_index(drop=True)
|
| 434 |
|
| 435 |
-
prop_dict = dict(zip(
|
| 436 |
-
|
| 437 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 438 |
team_dict = dict(zip(df.Player, df.Team))
|
| 439 |
-
under_dict = dict(zip(df.Player, df.Under))
|
| 440 |
|
| 441 |
total_sims = 1000
|
| 442 |
|
|
@@ -521,9 +525,12 @@ with tab6:
|
|
| 521 |
sim_all_hold = pd.concat([sim_all_hold, leg_outcomes], ignore_index=True)
|
| 522 |
|
| 523 |
final_outcomes = sim_all_hold
|
| 524 |
-
st.write(f'finished {prop}')
|
| 525 |
|
| 526 |
elif prop_type_var != 'All Props':
|
|
|
|
|
|
|
|
|
|
| 527 |
if game_select_var == 'Aggregate':
|
| 528 |
prop_df_raw = prop_frame[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
| 529 |
elif game_select_var == 'Pick6':
|
|
@@ -571,18 +578,22 @@ with tab6:
|
|
| 571 |
|
| 572 |
prop_df = prop_df[['Player', 'book', 'over_prop', 'over_line', 'under_line']]
|
| 573 |
prop_df = prop_df.rename(columns={"over_prop": "Prop"})
|
| 574 |
-
prop_df = prop_df[prop_df['Prop'] != 0]
|
| 575 |
-
prop_df = prop_df.drop_duplicates(subset=['Player'])
|
| 576 |
prop_df['Over'] = 1 / prop_df['over_line']
|
| 577 |
prop_df['Under'] = 1 / prop_df['under_line']
|
| 578 |
-
|
| 579 |
-
|
| 580 |
-
|
| 581 |
-
|
| 582 |
-
|
| 583 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 584 |
team_dict = dict(zip(df.Player, df.Team))
|
| 585 |
-
under_dict = dict(zip(df.Player, df.Under))
|
| 586 |
|
| 587 |
total_sims = 1000
|
| 588 |
|
|
@@ -667,7 +678,7 @@ with tab6:
|
|
| 667 |
sim_all_hold = pd.concat([sim_all_hold, leg_outcomes], ignore_index=True)
|
| 668 |
|
| 669 |
final_outcomes = sim_all_hold
|
| 670 |
-
st.write(f'finished {prop_type_var}')
|
| 671 |
|
| 672 |
final_outcomes = final_outcomes.dropna()
|
| 673 |
if game_select_var == 'Pick6':
|
|
|
|
| 408 |
with df_hold_container.container():
|
| 409 |
if prop_type_var == 'All Props':
|
| 410 |
if game_select_var == 'Aggregate':
|
| 411 |
+
prop_df_raw = prop_frame[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
| 412 |
sim_vars = ['NFL_GAME_PLAYER_PASSING_YARDS', 'NFL_GAME_PLAYER_RUSHING_YARDS', 'NFL_GAME_PLAYER_PASSING_ATTEMPTS', 'NFL_GAME_PLAYER_PASSING_TOUCHDOWNS', 'NFL_GAME_PLAYER_RUSHING_ATTEMPTS',
|
| 413 |
'NFL_GAME_PLAYER_RECEIVING_RECEPTIONS', 'NFL_GAME_PLAYER_RECEIVING_YARDS', 'NFL_GAME_PLAYER_RECEIVING_TOUCHDOWNS']
|
| 414 |
elif game_select_var == 'Pick6':
|
| 415 |
+
prop_df_raw = pick_frame[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
| 416 |
sim_vars = ['Rush + Rec Yards', 'Rush + Rec TDs', 'Passing Yards', 'Passing Attempts', 'Passing TDs', 'Rushing Attempts', 'Rushing Yards', 'Receptions', 'Receiving Yards', 'Receiving TDs']
|
| 417 |
+
|
| 418 |
+
player_df = overall_stats.copy()
|
| 419 |
+
|
| 420 |
for prop in sim_vars:
|
| 421 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 422 |
for books in book_selections:
|
| 423 |
prop_df = prop_df_raw[prop_df_raw['book'] == books]
|
| 424 |
prop_df = prop_df[prop_df['prop_type'] == prop]
|
| 425 |
prop_df = prop_df[~((prop_df['over_prop'] < 15) & (prop_df['prop_type'] == 'NFL_GAME_PLAYER_RUSHING_YARDS'))]
|
| 426 |
prop_df = prop_df[['Player', 'book', 'over_prop', 'over_line', 'under_line']]
|
| 427 |
prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
|
|
|
|
|
|
|
| 428 |
prop_df['Over'] = 1 / prop_df['over_line']
|
| 429 |
prop_df['Under'] = 1 / prop_df['under_line']
|
|
|
|
|
|
|
| 430 |
|
| 431 |
+
prop_dict = dict(zip(prop_df.Player, prop_df.Prop))
|
| 432 |
+
prop_type_dict = dict(zip(prop_df.Player, prop_df.prop_type))
|
| 433 |
+
book_dict = dict(zip(prop_df.Player, prop_df.book))
|
| 434 |
+
over_dict = dict(zip(prop_df.Player, prop_df.Over))
|
| 435 |
+
under_dict = dict(zip(prop_df.Player, prop_df.Under))
|
| 436 |
+
|
| 437 |
+
player_df['book'] = player_df['Player'].map(book_dict)
|
| 438 |
+
player_df['Prop'] = player_df['Player'].map(prop_dict)
|
| 439 |
+
player_df['prop_type'] = player_df['Player'].map(prop_type_dict)
|
| 440 |
+
|
| 441 |
+
df = player_df.reset_index(drop=True)
|
| 442 |
+
|
| 443 |
team_dict = dict(zip(df.Player, df.Team))
|
|
|
|
| 444 |
|
| 445 |
total_sims = 1000
|
| 446 |
|
|
|
|
| 525 |
sim_all_hold = pd.concat([sim_all_hold, leg_outcomes], ignore_index=True)
|
| 526 |
|
| 527 |
final_outcomes = sim_all_hold
|
| 528 |
+
st.write(f'finished {prop} for {books}')
|
| 529 |
|
| 530 |
elif prop_type_var != 'All Props':
|
| 531 |
+
|
| 532 |
+
player_df = overall_stats.copy()
|
| 533 |
+
|
| 534 |
if game_select_var == 'Aggregate':
|
| 535 |
prop_df_raw = prop_frame[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
| 536 |
elif game_select_var == 'Pick6':
|
|
|
|
| 578 |
|
| 579 |
prop_df = prop_df[['Player', 'book', 'over_prop', 'over_line', 'under_line']]
|
| 580 |
prop_df = prop_df.rename(columns={"over_prop": "Prop"})
|
|
|
|
|
|
|
| 581 |
prop_df['Over'] = 1 / prop_df['over_line']
|
| 582 |
prop_df['Under'] = 1 / prop_df['under_line']
|
| 583 |
+
|
| 584 |
+
prop_dict = dict(zip(prop_df.Player, prop_df.Prop))
|
| 585 |
+
prop_type_dict = dict(zip(prop_df.Player, prop_df.prop_type))
|
| 586 |
+
book_dict = dict(zip(prop_df.Player, prop_df.book))
|
| 587 |
+
over_dict = dict(zip(prop_df.Player, prop_df.Over))
|
| 588 |
+
under_dict = dict(zip(prop_df.Player, prop_df.Under))
|
| 589 |
+
|
| 590 |
+
player_df['book'] = player_df['Player'].map(book_dict)
|
| 591 |
+
player_df['Prop'] = player_df['Player'].map(prop_dict)
|
| 592 |
+
player_df['prop_type'] = player_df['Player'].map(prop_type_dict)
|
| 593 |
+
|
| 594 |
+
df = player_df.reset_index(drop=True)
|
| 595 |
+
|
| 596 |
team_dict = dict(zip(df.Player, df.Team))
|
|
|
|
| 597 |
|
| 598 |
total_sims = 1000
|
| 599 |
|
|
|
|
| 678 |
sim_all_hold = pd.concat([sim_all_hold, leg_outcomes], ignore_index=True)
|
| 679 |
|
| 680 |
final_outcomes = sim_all_hold
|
| 681 |
+
st.write(f'finished {prop_type_var} for {books}')
|
| 682 |
|
| 683 |
final_outcomes = final_outcomes.dropna()
|
| 684 |
if game_select_var == 'Pick6':
|