Spaces:
Running
Running
James McCool
commited on
Commit
·
1a7cb58
1
Parent(s):
2d5b5b0
Add team ownership calculations to scoring percentages in app.py by filtering out pitchers and aggregating ownership data, enhancing player metrics for analysis.
Browse files
app.py
CHANGED
@@ -87,6 +87,10 @@ 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']]
|
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 |
|
91 |
return roo_data, sd_roo_data, scoring_percentages, dk_roo, fd_roo
|
92 |
|
|
|
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']]
|
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 |
+
hitters_only = dk_roo[dk_roo['pos_group'] != 'Pitchers']
|
91 |
+
team_ownership = hitters_only.groupby('Team')['Own%'].sum().reset_index()
|
92 |
+
scoring_percentages = scoring_percentages.merge(team_ownership, left_on='Names', right_on='Team', how='left')
|
93 |
+
scoring_percentages.drop('Team', axis=1, inplace=True)
|
94 |
|
95 |
return roo_data, sd_roo_data, scoring_percentages, dk_roo, fd_roo
|
96 |
|