Spaces:
Running
Running
James McCool
commited on
Commit
·
e840845
1
Parent(s):
96aabe9
Refactor data handling in app.py to create a separate hold_frame for 'Order' and 'Hand' attributes, improving clarity and organization in player data processing for hitters.
Browse files
app.py
CHANGED
@@ -76,8 +76,13 @@ def init_baselines():
|
|
76 |
|
77 |
roo_data = player_frame.drop(columns=['_id'])
|
78 |
roo_data['Salary'] = roo_data['Salary'].astype(int)
|
79 |
-
|
80 |
-
|
|
|
|
|
|
|
|
|
|
|
81 |
|
82 |
dk_roo = roo_data[roo_data['Site'] == 'Draftkings']
|
83 |
dk_id_map = dict(zip(dk_roo['Player'], dk_roo['player_ID']))
|
|
|
76 |
|
77 |
roo_data = player_frame.drop(columns=['_id'])
|
78 |
roo_data['Salary'] = roo_data['Salary'].astype(int)
|
79 |
+
hold_frame = roo_data.copy()
|
80 |
+
|
81 |
+
hold_frame['Order'] = np.where(hold_frame['pos_group'] == 'Hitters', hold_frame['Player'].map(RHP_Info.set_index('Player')['Order']), '')
|
82 |
+
hold_frame['Hand'] = np.where(hold_frame['pos_group'] == 'Hitters', hold_frame['Player'].map(RHP_Info.set_index('Player')['bats']), '')
|
83 |
+
|
84 |
+
roo_data.insert(3, 'Hand', hold_frame['Hand'])
|
85 |
+
roo_data.insert(4, 'Order', hold_frame['Order'])
|
86 |
|
87 |
dk_roo = roo_data[roo_data['Site'] == 'Draftkings']
|
88 |
dk_id_map = dict(zip(dk_roo['Player'], dk_roo['player_ID']))
|