James McCool commited on
Commit
4ac0202
·
1 Parent(s): b6f18d3

Enhance prop percentage calculations in app.py by incorporating 'over_adj' and 'under_adj' metrics into 'Over%' and 'Under%' formulas. This update improves the accuracy of player projections by factoring in adjustments based on the relationship between 'Mean_Outcome' and 'Prop', ensuring a more reliable analysis of prop outcomes.

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -288,15 +288,17 @@ 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['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
292
  players_only['10%'] = overall_file.quantile(0.1, axis=1)
293
  players_only['90%'] = overall_file.quantile(0.9, axis=1)
294
  players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
295
  players_only['Imp Over'] = players_only['Player'].map(over_dict)
296
- players_only['Over%'] = (players_only['Over'] * 0.4) + (players_only['Trending Over'] * 0.4) + (players_only['Imp Over'] * 0.2)
297
  players_only['Under'] = np_where(players_only['Prop'] <= 3, 1 - players_only['poisson_var'], prop_check[prop_check < 0].count(axis=1)/float(total_sims))
298
  players_only['Imp Under'] = players_only['Player'].map(under_dict)
299
- players_only['Under%'] = (players_only['Under'] * 0.4) + (players_only['Trending Under'] * 0.4) + (players_only['Imp Under'] * 0.2)
300
  players_only['Prop_avg'] = players_only['Prop'].mean() / 100
301
  players_only['prop_threshold'] = .10
302
  players_only = players_only[players_only['Mean_Outcome'] > 0]
@@ -416,15 +418,17 @@ with tab3:
416
  players_only['Book'] = players_only['Player'].map(book_dict)
417
  players_only['Trending Over'] = players_only['Player'].map(trending_over_dict)
418
  players_only['Trending Under'] = players_only['Player'].map(trending_under_dict)
 
 
419
  players_only['poisson_var'] = players_only.apply(calculate_poisson, axis=1)
420
  players_only['10%'] = overall_file.quantile(0.1, axis=1)
421
  players_only['90%'] = overall_file.quantile(0.9, axis=1)
422
  players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
423
  players_only['Imp Over'] = players_only['Player'].map(over_dict)
424
- players_only['Over%'] = (players_only['Over'] * 0.4) + (players_only['Trending Over'] * 0.4) + (players_only['Imp Over'] * 0.2)
425
  players_only['Under'] = np_where(players_only['Prop'] <= 3, 1 - players_only['poisson_var'], prop_check[prop_check < 0].count(axis=1)/float(total_sims))
426
  players_only['Imp Under'] = players_only['Player'].map(under_dict)
427
- players_only['Under%'] = (players_only['Under'] * 0.4) + (players_only['Trending Under'] * 0.4) + (players_only['Imp Under'] * 0.2)
428
  players_only['Prop_avg'] = players_only['Prop'].mean() / 100
429
  players_only['prop_threshold'] = .10
430
  players_only = players_only[players_only['Mean_Outcome'] > 0]
 
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
292
+ players_only['under_adj'] = (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)
296
  players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
297
  players_only['Imp Over'] = players_only['Player'].map(over_dict)
298
+ players_only['Over%'] = (players_only['Over'] * 0.4) + (players_only['Trending Over'] * 0.4) + (players_only['Imp Over'] * 0.2) + players_only['over_adj']
299
  players_only['Under'] = np_where(players_only['Prop'] <= 3, 1 - players_only['poisson_var'], prop_check[prop_check < 0].count(axis=1)/float(total_sims))
300
  players_only['Imp Under'] = players_only['Player'].map(under_dict)
301
+ players_only['Under%'] = (players_only['Under'] * 0.4) + (players_only['Trending Under'] * 0.4) + (players_only['Imp Under'] * 0.2) + players_only['under_adj']
302
  players_only['Prop_avg'] = players_only['Prop'].mean() / 100
303
  players_only['prop_threshold'] = .10
304
  players_only = players_only[players_only['Mean_Outcome'] > 0]
 
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
422
+ players_only['under_adj'] = (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)
426
  players_only['Over'] = np_where(players_only['Prop'] <= 3, players_only['poisson_var'], prop_check[prop_check > 0].count(axis=1)/float(total_sims))
427
  players_only['Imp Over'] = players_only['Player'].map(over_dict)
428
+ players_only['Over%'] = (players_only['Over'] * 0.4) + (players_only['Trending Over'] * 0.4) + (players_only['Imp Over'] * 0.2) + players_only['over_adj']
429
  players_only['Under'] = np_where(players_only['Prop'] <= 3, 1 - players_only['poisson_var'], prop_check[prop_check < 0].count(axis=1)/float(total_sims))
430
  players_only['Imp Under'] = players_only['Player'].map(under_dict)
431
+ players_only['Under%'] = (players_only['Under'] * 0.4) + (players_only['Trending Under'] * 0.4) + (players_only['Imp Under'] * 0.2) + players_only['under_adj']
432
  players_only['Prop_avg'] = players_only['Prop'].mean() / 100
433
  players_only['prop_threshold'] = .10
434
  players_only = players_only[players_only['Mean_Outcome'] > 0]