Spaces:
Running
Running
James McCool
commited on
Commit
·
b2e59e8
1
Parent(s):
dd4eb4f
Add Hitter_Info integration in app.py to enhance player data processing by including 'Order' and 'Hand' attributes for hitters, improving data analysis capabilities.
Browse files
app.py
CHANGED
@@ -63,12 +63,19 @@ st.markdown("""
|
|
63 |
|
64 |
@st.cache_resource(ttl = 60)
|
65 |
def init_baselines():
|
|
|
|
|
|
|
|
|
|
|
66 |
collection = db["Player_Range_Of_Outcomes"]
|
67 |
cursor = collection.find()
|
68 |
player_frame = pd.DataFrame(cursor)
|
69 |
|
70 |
roo_data = player_frame.drop(columns=['_id'])
|
71 |
roo_data['Salary'] = roo_data['Salary'].astype(int)
|
|
|
|
|
72 |
|
73 |
dk_roo = roo_data[roo_data['Site'] == 'Draftkings']
|
74 |
dk_id_map = dict(zip(dk_roo['Player'], dk_roo['player_ID']))
|
|
|
63 |
|
64 |
@st.cache_resource(ttl = 60)
|
65 |
def init_baselines():
|
66 |
+
|
67 |
+
collection = db["Hitter_Info"]
|
68 |
+
cursor = collection.find()
|
69 |
+
Hitter_info = pd.DataFrame(cursor)
|
70 |
+
|
71 |
collection = db["Player_Range_Of_Outcomes"]
|
72 |
cursor = collection.find()
|
73 |
player_frame = pd.DataFrame(cursor)
|
74 |
|
75 |
roo_data = player_frame.drop(columns=['_id'])
|
76 |
roo_data['Salary'] = roo_data['Salary'].astype(int)
|
77 |
+
roo_data['Order'] = np.where(roo_data['pos_group'] == 'Hitters', roo_data['Player'].map(Hitter_info.set_index('Player')['Order']), '')
|
78 |
+
roo_data['Hand'] = np.where(roo_data['pos_group'] == 'Hitters', roo_data['Player'].map(Hitter_info.set_index('Player')['bats']), '')
|
79 |
|
80 |
dk_roo = roo_data[roo_data['Site'] == 'Draftkings']
|
81 |
dk_id_map = dict(zip(dk_roo['Player'], dk_roo['player_ID']))
|