James McCool commited on
Commit
b326a45
·
1 Parent(s): 3173651

Update 'Top Score' handling in scoring percentages calculation in app.py to replace empty strings with NaN before casting to float, improving data integrity in player metrics analysis.

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -87,7 +87,7 @@ def init_baselines():
87
  scoring_percentages = scoring_percentages[['Names', 'Avg First Inning', 'First Inning Lead Percentage', 'Avg Fifth Inning', 'Fifth Inning Lead Percentage', 'Avg Score', '8+ runs', 'Win Percentage', 'Slate', 'Top Score']]
88
  scoring_percentages['8+ runs'] = scoring_percentages['8+ runs'].replace('%', '', regex=True).astype(float)
89
  scoring_percentages['Win Percentage'] = scoring_percentages['Win Percentage'].replace('%', '', regex=True).astype(float)
90
- scoring_percentages['Top Score'] = scoring_percentages['Top Score'].astype(float)
91
  dk_hitters_only = dk_roo[dk_roo['pos_group'] != 'Pitchers']
92
  dk_team_ownership = dk_hitters_only.groupby('Team')['Own%'].sum().reset_index()
93
  fd_hitters_only = fd_roo[fd_roo['pos_group'] != 'Pitchers']
 
87
  scoring_percentages = scoring_percentages[['Names', 'Avg First Inning', 'First Inning Lead Percentage', 'Avg Fifth Inning', 'Fifth Inning Lead Percentage', 'Avg Score', '8+ runs', 'Win Percentage', 'Slate', 'Top Score']]
88
  scoring_percentages['8+ runs'] = scoring_percentages['8+ runs'].replace('%', '', regex=True).astype(float)
89
  scoring_percentages['Win Percentage'] = scoring_percentages['Win Percentage'].replace('%', '', regex=True).astype(float)
90
+ scoring_percentages['Top Score'] = scoring_percentages['Top Score'].replace('', np.nan).astype(float)
91
  dk_hitters_only = dk_roo[dk_roo['pos_group'] != 'Pitchers']
92
  dk_team_ownership = dk_hitters_only.groupby('Team')['Own%'].sum().reset_index()
93
  fd_hitters_only = fd_roo[fd_roo['pos_group'] != 'Pitchers']