James McCool commited on
Commit
f48225e
·
1 Parent(s): 95055fb

Refactor app.py to update 'over_adj' and 'under_adj' calculations by replacing division by 100 with a conditional adjustment using np_where. This change ensures that adjustments are capped at 0.10, improving the accuracy and reliability of player projections based on the relationship between 'Mean_Outcome' and 'Prop'.

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -288,8 +288,8 @@ with tab3:
288
  players_only['Book'] = players_only['Player'].map(book_dict)
289
  players_only['Trending Over'] = players_only['Player'].map(trending_over_dict)
290
  players_only['Trending Under'] = players_only['Player'].map(trending_under_dict)
291
- players_only['over_adj'] = ((players_only['Mean_Outcome'] / players_only['Prop']) - 1) / 100
292
- players_only['under_adj'] = ((players_only['Prop'] / players_only['Mean_Outcome']) - 1) / 100
293
  players_only['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
294
  players_only['10%'] = overall_file.quantile(0.1, axis=1)
295
  players_only['90%'] = overall_file.quantile(0.9, axis=1)
@@ -418,8 +418,8 @@ with tab3:
418
  players_only['Book'] = players_only['Player'].map(book_dict)
419
  players_only['Trending Over'] = players_only['Player'].map(trending_over_dict)
420
  players_only['Trending Under'] = players_only['Player'].map(trending_under_dict)
421
- players_only['over_adj'] = ((players_only['Mean_Outcome'] / players_only['Prop']) - 1) / 100
422
- players_only['under_adj'] = ((players_only['Prop'] / players_only['Mean_Outcome']) - 1) / 100
423
  players_only['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
424
  players_only['10%'] = overall_file.quantile(0.1, axis=1)
425
  players_only['90%'] = overall_file.quantile(0.9, axis=1)
 
288
  players_only['Book'] = players_only['Player'].map(book_dict)
289
  players_only['Trending Over'] = players_only['Player'].map(trending_over_dict)
290
  players_only['Trending Under'] = players_only['Player'].map(trending_under_dict)
291
+ players_only['over_adj'] = np_where((players_only['Mean_Outcome'] / players_only['Prop']) - 1 > .10, .10, (players_only['Mean_Outcome'] / players_only['Prop']) - 1)
292
+ players_only['under_adj'] = np_where((players_only['Prop'] / players_only['Mean_Outcome']) - 1 > .10, .10, (players_only['Prop'] / players_only['Mean_Outcome']) - 1)
293
  players_only['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
294
  players_only['10%'] = overall_file.quantile(0.1, axis=1)
295
  players_only['90%'] = overall_file.quantile(0.9, axis=1)
 
418
  players_only['Book'] = players_only['Player'].map(book_dict)
419
  players_only['Trending Over'] = players_only['Player'].map(trending_over_dict)
420
  players_only['Trending Under'] = players_only['Player'].map(trending_under_dict)
421
+ players_only['over_adj'] = np_where((players_only['Mean_Outcome'] / players_only['Prop']) - 1 > .10, .10, (players_only['Mean_Outcome'] / players_only['Prop']) - 1)
422
+ players_only['under_adj'] = np_where((players_only['Prop'] / players_only['Mean_Outcome']) - 1 > .10, .10, (players_only['Prop'] / players_only['Mean_Outcome']) - 1)
423
  players_only['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
424
  players_only['10%'] = overall_file.quantile(0.1, axis=1)
425
  players_only['90%'] = overall_file.quantile(0.9, axis=1)