Spaces:
Sleeping
Sleeping
James McCool
commited on
Commit
·
cbef4f6
1
Parent(s):
16200b0
Enhance data integration in init_baselines function
Browse files- Add retrieval of PGA placement rates and map Cut_Odds to player_frame
- Update display logic to include Cut_Odds in the Simple view
- Ensure Salary column is correctly formatted as an integer
app.py
CHANGED
|
@@ -63,9 +63,17 @@ st.markdown("""
|
|
| 63 |
|
| 64 |
@st.cache_resource(ttl = 60)
|
| 65 |
def init_baselines():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
collection = db["PGA_Range_of_Outcomes"]
|
| 67 |
cursor = collection.find()
|
| 68 |
player_frame = pd.DataFrame(cursor)
|
|
|
|
|
|
|
|
|
|
| 69 |
|
| 70 |
timestamp = player_frame['Timestamp'][0]
|
| 71 |
|
|
@@ -76,6 +84,9 @@ def init_baselines():
|
|
| 76 |
cursor = collection.find()
|
| 77 |
player_frame = pd.DataFrame(cursor)
|
| 78 |
|
|
|
|
|
|
|
|
|
|
| 79 |
sd_roo_data = player_frame.drop(columns=['_id', 'index'])
|
| 80 |
sd_roo_data['Salary'] = sd_roo_data['Salary'].astype(int)
|
| 81 |
|
|
@@ -184,7 +195,7 @@ with tab1:
|
|
| 184 |
|
| 185 |
if view_var == "Simple":
|
| 186 |
if type_var == "Full Slate":
|
| 187 |
-
display = display[['Player', 'Salary', 'Median', '10x%', 'Own']]
|
| 188 |
display = display.set_index('Player')
|
| 189 |
elif type_var == "Showdown":
|
| 190 |
display = display[['Player', 'Salary', 'Median', '5x%', 'Own']]
|
|
|
|
| 63 |
|
| 64 |
@st.cache_resource(ttl = 60)
|
| 65 |
def init_baselines():
|
| 66 |
+
|
| 67 |
+
collection = db["PGA_Placement_Rates"]
|
| 68 |
+
cursor = collection.find()
|
| 69 |
+
placement_frame = pd.DataFrame(cursor)
|
| 70 |
+
|
| 71 |
collection = db["PGA_Range_of_Outcomes"]
|
| 72 |
cursor = collection.find()
|
| 73 |
player_frame = pd.DataFrame(cursor)
|
| 74 |
+
|
| 75 |
+
player_frame['Cut_Odds'] = player_frame['Player'].map(placement_frame['Cut_Odds'])
|
| 76 |
+
player_frame = player_frame[['Player', 'Cut_Odds'] + [col for col in player_frame.columns if col not in ['Player', 'Cut_Odds']]]
|
| 77 |
|
| 78 |
timestamp = player_frame['Timestamp'][0]
|
| 79 |
|
|
|
|
| 84 |
cursor = collection.find()
|
| 85 |
player_frame = pd.DataFrame(cursor)
|
| 86 |
|
| 87 |
+
sd_roo_data = player_frame.drop(columns=['_id', 'index'])
|
| 88 |
+
sd_roo_data['Salary'] = sd_roo_data['Salary'].astype(int)
|
| 89 |
+
|
| 90 |
sd_roo_data = player_frame.drop(columns=['_id', 'index'])
|
| 91 |
sd_roo_data['Salary'] = sd_roo_data['Salary'].astype(int)
|
| 92 |
|
|
|
|
| 195 |
|
| 196 |
if view_var == "Simple":
|
| 197 |
if type_var == "Full Slate":
|
| 198 |
+
display = display[['Player', 'Cut_Odds', 'Salary', 'Median', '10x%', 'Own']]
|
| 199 |
display = display.set_index('Player')
|
| 200 |
elif type_var == "Showdown":
|
| 201 |
display = display[['Player', 'Salary', 'Median', '5x%', 'Own']]
|