James McCool commited on
Commit
6947c31
·
1 Parent(s): 8bf3c08

maybe removing .loc helps since it's index based?

Browse files
Files changed (1) hide show
  1. app.py +24 -24
app.py CHANGED
@@ -274,7 +274,7 @@ with tab4:
274
 
275
  df.replace("", 0, inplace=True)
276
 
277
- player_var = df.loc[df['Player'] == player_check]
278
  player_var = player_var.reset_index()
279
 
280
  if prop_type_var == 'points':
@@ -334,8 +334,8 @@ with tab4:
334
 
335
  final_outcomes = players_only[['Player', '10%', 'Mean_Outcome', '90%', 'implied_odds', 'beat_prop']]
336
  final_outcomes['Bet?'] = np.where(final_outcomes['beat_prop'] - final_outcomes['implied_odds'] >= .10, "Bet", "No Bet")
337
- final_outcomes = final_outcomes.loc[final_outcomes['Player'] == player_check]
338
- player_outcomes = player_outcomes.loc[player_outcomes['Player'] == player_check]
339
  player_outcomes = player_outcomes.drop(columns=['Player']).transpose()
340
  player_outcomes = player_outcomes.reset_index()
341
  player_outcomes.columns = ['Instance', 'Outcome']
@@ -425,10 +425,10 @@ with tab5:
425
  for prop in sim_vars:
426
  st.write(prop)
427
  st.table(prop_df_raw)
428
- prop_df = prop_df_raw.loc[prop_df_raw['prop_type'] == prop]
429
 
430
  for books in book_selections:
431
- prop_df = prop_df.loc[prop_df['book'] == books]
432
  prop_df = prop_df[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
433
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
434
  prop_df['Over'] = 1 / prop_df['over_line']
@@ -511,7 +511,7 @@ with tab5:
511
  players_only['Book'] = players_only['Player'].map(book_dict)
512
  players_only['Prop_avg'] = players_only['Prop'].mean() / 100
513
  players_only['prop_threshold'] = .10
514
- players_only = players_only.loc[players_only['Mean_Outcome'] > 0]
515
  players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
516
  players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
517
  players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] , players_only['Under_diff'])
@@ -537,40 +537,40 @@ with tab5:
537
  prop_df_raw = prop_df_raw.rename(columns={"Full_name": "Player"})
538
 
539
  for books in book_selections:
540
- prop_df = prop_df_raw.loc[prop_df_raw['book'] == books]
541
 
542
  if prop_type_var == "NBA_GAME_PLAYER_POINTS":
543
- prop_df = prop_df.loc[prop_df['prop_type'] == 'NBA_GAME_PLAYER_POINTS']
544
  elif prop_type_var == "Points":
545
- prop_df = prop_df.loc[prop_df['prop_type'] == 'Points']
546
  elif prop_type_var == "NBA_GAME_PLAYER_REBOUNDS":
547
- prop_df = prop_df.loc[prop_df['prop_type'] == 'NBA_GAME_PLAYER_REBOUNDS']
548
  elif prop_type_var == "Rebounds":
549
- prop_df = prop_df.loc[prop_df['prop_type'] == 'Rebounds']
550
  elif prop_type_var == "NBA_GAME_PLAYER_ASSISTS":
551
- prop_df = prop_df.loc[prop_df['prop_type'] == 'NBA_GAME_PLAYER_ASSISTS']
552
  elif prop_type_var == "Assists":
553
- prop_df = prop_df.loc[prop_df['prop_type'] == 'Assists']
554
  elif prop_type_var == "NBA_GAME_PLAYER_3_POINTERS_MADE":
555
- prop_df = prop_df.loc[prop_df['prop_type'] == 'NBA_GAME_PLAYER_3_POINTERS_MADE']
556
  elif prop_type_var == "3-Pointers Made":
557
- prop_df = prop_df.loc[prop_df['prop_type'] == '3-Pointers Made']
558
  elif prop_type_var == "NBA_GAME_PLAYER_POINTS_REBOUNDS_ASSISTS":
559
- prop_df = prop_df.loc[prop_df['prop_type'] == 'NBA_GAME_PLAYER_POINTS_REBOUNDS_ASSISTS']
560
  elif prop_type_var == "Points + Assists + Rebounds":
561
- prop_df = prop_df.loc[prop_df['prop_type'] == 'Points + Assists + Rebounds']
562
  elif prop_type_var == "NBA_GAME_PLAYER_POINTS_REBOUNDS":
563
- prop_df = prop_df.loc[prop_df['prop_type'] == 'NBA_GAME_PLAYER_POINTS_REBOUNDS']
564
  elif prop_type_var == "Points + Rebounds":
565
- prop_df = prop_df.loc[prop_df['prop_type'] == 'Points + Rebounds']
566
  elif prop_type_var == "NBA_GAME_PLAYER_POINTS_ASSISTS":
567
- prop_df = prop_df.loc[prop_df['prop_type'] == 'NBA_GAME_PLAYER_POINTS_ASSISTS']
568
  elif prop_type_var == "Points + Assists":
569
- prop_df = prop_df.loc[prop_df['prop_type'] == 'Points + Assists']
570
  elif prop_type_var == "NBA_GAME_PLAYER_REBOUNDS_ASSISTS":
571
- prop_df = prop_df.loc[prop_df['prop_type'] == 'NBA_GAME_PLAYER_REBOUNDS_ASSISTS']
572
  elif prop_type_var == "Assists + Rebounds":
573
- prop_df = prop_df.loc[prop_df['prop_type'] == 'Assists + Rebounds']
574
 
575
  prop_df = prop_df[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
576
  prop_df = prop_df.rename(columns={"over_prop": "Prop"})
@@ -650,7 +650,7 @@ with tab5:
650
  players_only['Prop'] = players_only['Player'].map(prop_dict)
651
  players_only['Prop_avg'] = players_only['Prop'].mean() / 100
652
  players_only['prop_threshold'] = .10
653
- players_only = players_only.loc[players_only['Mean_Outcome'] > 0]
654
  players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
655
  players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
656
  players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] , players_only['Under_diff'])
 
274
 
275
  df.replace("", 0, inplace=True)
276
 
277
+ player_var = df[df['Player'] == player_check]
278
  player_var = player_var.reset_index()
279
 
280
  if prop_type_var == 'points':
 
334
 
335
  final_outcomes = players_only[['Player', '10%', 'Mean_Outcome', '90%', 'implied_odds', 'beat_prop']]
336
  final_outcomes['Bet?'] = np.where(final_outcomes['beat_prop'] - final_outcomes['implied_odds'] >= .10, "Bet", "No Bet")
337
+ final_outcomes = final_outcomes[final_outcomes['Player'] == player_check]
338
+ player_outcomes = player_outcomes[player_outcomes['Player'] == player_check]
339
  player_outcomes = player_outcomes.drop(columns=['Player']).transpose()
340
  player_outcomes = player_outcomes.reset_index()
341
  player_outcomes.columns = ['Instance', 'Outcome']
 
425
  for prop in sim_vars:
426
  st.write(prop)
427
  st.table(prop_df_raw)
428
+ prop_df = prop_df_raw[prop_df_raw['prop_type'] == prop]
429
 
430
  for books in book_selections:
431
+ prop_df = prop_df[prop_df['book'] == books]
432
  prop_df = prop_df[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
433
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
434
  prop_df['Over'] = 1 / prop_df['over_line']
 
511
  players_only['Book'] = players_only['Player'].map(book_dict)
512
  players_only['Prop_avg'] = players_only['Prop'].mean() / 100
513
  players_only['prop_threshold'] = .10
514
+ players_only = players_only[players_only['Mean_Outcome'] > 0]
515
  players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
516
  players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
517
  players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] , players_only['Under_diff'])
 
537
  prop_df_raw = prop_df_raw.rename(columns={"Full_name": "Player"})
538
 
539
  for books in book_selections:
540
+ prop_df = prop_df_raw[prop_df_raw['book'] == books]
541
 
542
  if prop_type_var == "NBA_GAME_PLAYER_POINTS":
543
+ prop_df = prop_df[prop_df['prop_type'] == 'NBA_GAME_PLAYER_POINTS']
544
  elif prop_type_var == "Points":
545
+ prop_df = prop_df[prop_df['prop_type'] == 'Points']
546
  elif prop_type_var == "NBA_GAME_PLAYER_REBOUNDS":
547
+ prop_df = prop_df[prop_df['prop_type'] == 'NBA_GAME_PLAYER_REBOUNDS']
548
  elif prop_type_var == "Rebounds":
549
+ prop_df = prop_df[prop_df['prop_type'] == 'Rebounds']
550
  elif prop_type_var == "NBA_GAME_PLAYER_ASSISTS":
551
+ prop_df = prop_df[prop_df['prop_type'] == 'NBA_GAME_PLAYER_ASSISTS']
552
  elif prop_type_var == "Assists":
553
+ prop_df = prop_df[prop_df['prop_type'] == 'Assists']
554
  elif prop_type_var == "NBA_GAME_PLAYER_3_POINTERS_MADE":
555
+ prop_df = prop_df[prop_df['prop_type'] == 'NBA_GAME_PLAYER_3_POINTERS_MADE']
556
  elif prop_type_var == "3-Pointers Made":
557
+ prop_df = prop_df[prop_df['prop_type'] == '3-Pointers Made']
558
  elif prop_type_var == "NBA_GAME_PLAYER_POINTS_REBOUNDS_ASSISTS":
559
+ prop_df = prop_df[prop_df['prop_type'] == 'NBA_GAME_PLAYER_POINTS_REBOUNDS_ASSISTS']
560
  elif prop_type_var == "Points + Assists + Rebounds":
561
+ prop_df = prop_df[prop_df['prop_type'] == 'Points + Assists + Rebounds']
562
  elif prop_type_var == "NBA_GAME_PLAYER_POINTS_REBOUNDS":
563
+ prop_df = prop_df[prop_df['prop_type'] == 'NBA_GAME_PLAYER_POINTS_REBOUNDS']
564
  elif prop_type_var == "Points + Rebounds":
565
+ prop_df = prop_df[prop_df['prop_type'] == 'Points + Rebounds']
566
  elif prop_type_var == "NBA_GAME_PLAYER_POINTS_ASSISTS":
567
+ prop_df = prop_df[prop_df['prop_type'] == 'NBA_GAME_PLAYER_POINTS_ASSISTS']
568
  elif prop_type_var == "Points + Assists":
569
+ prop_df = prop_df[prop_df['prop_type'] == 'Points + Assists']
570
  elif prop_type_var == "NBA_GAME_PLAYER_REBOUNDS_ASSISTS":
571
+ prop_df = prop_df[prop_df['prop_type'] == 'NBA_GAME_PLAYER_REBOUNDS_ASSISTS']
572
  elif prop_type_var == "Assists + Rebounds":
573
+ prop_df = prop_df[prop_df['prop_type'] == 'Assists + Rebounds']
574
 
575
  prop_df = prop_df[['Player', 'book', 'over_prop', 'over_line', 'under_line', 'prop_type']]
576
  prop_df = prop_df.rename(columns={"over_prop": "Prop"})
 
650
  players_only['Prop'] = players_only['Player'].map(prop_dict)
651
  players_only['Prop_avg'] = players_only['Prop'].mean() / 100
652
  players_only['prop_threshold'] = .10
653
+ players_only = players_only[players_only['Mean_Outcome'] > 0]
654
  players_only['Over_diff'] = players_only['Over%'] - players_only['Imp Over']
655
  players_only['Under_diff'] = players_only['Under%'] - players_only['Imp Under']
656
  players_only['Bet_check'] = np.where(players_only['Over_diff'] > players_only['Under_diff'], players_only['Over_diff'] , players_only['Under_diff'])