Spaces:
Running
Running
James McCool
commited on
Commit
·
fe4a9c1
1
Parent(s):
4b41aad
Refactor player data mapping in app.py to improve position-based logic
Browse filesUpdated the conditions for mapping 'Order' and 'Hand' in sd_hold_frame to check for 'Position' instead of 'pos_group'. This change enhances the accuracy of player data assignments and maintains the integrity of the data processing logic.
app.py
CHANGED
@@ -131,8 +131,8 @@ def init_baselines():
|
|
131 |
sd_roo_data = sd_roo_data.rename(columns={'Own': 'Own%', 'Small_Own': 'Small Field Own%', 'Large_Own': 'Large Field Own%', 'Cash_Own': 'Cash Own%'})
|
132 |
sd_hold_frame = sd_roo_data.copy()
|
133 |
|
134 |
-
sd_hold_frame['Order'] = np.where(sd_hold_frame['
|
135 |
-
sd_hold_frame['Hand'] = np.where(sd_hold_frame['
|
136 |
try:
|
137 |
sd_hold_frame['Opp'] = sd_hold_frame['Team'].map(RHH_Info.drop_duplicates(subset='Team').set_index('Team')['Opp'])
|
138 |
except:
|
|
|
131 |
sd_roo_data = sd_roo_data.rename(columns={'Own': 'Own%', 'Small_Own': 'Small Field Own%', 'Large_Own': 'Large Field Own%', 'Cash_Own': 'Cash Own%'})
|
132 |
sd_hold_frame = sd_roo_data.copy()
|
133 |
|
134 |
+
sd_hold_frame['Order'] = np.where(sd_hold_frame['Position'] != 'SP', sd_hold_frame['Player'].map(RHP_Info.set_index('Player')['Order']), 0)
|
135 |
+
sd_hold_frame['Hand'] = np.where(sd_hold_frame['Position'] != 'SP', sd_hold_frame['Player'].map(RHP_Info.set_index('Player')['bats']), sd_hold_frame['Player'].map(RHH_Info.set_index('Player')['Hand']))
|
136 |
try:
|
137 |
sd_hold_frame['Opp'] = sd_hold_frame['Team'].map(RHH_Info.drop_duplicates(subset='Team').set_index('Team')['Opp'])
|
138 |
except:
|