Spaces:
Running
Running
James McCool
commited on
Commit
·
8ae810a
1
Parent(s):
24e9e65
Refactor app.py: Simplify data processing and enhance site selection UI. Removed unnecessary data type conversion for player frame and improved select box label for site selection. Streamlined data filtering for display based on selected site.
Browse files
app.py
CHANGED
@@ -32,8 +32,6 @@ def init_baselines():
|
|
32 |
collection = db["PGA_Range_of_Outcomes"]
|
33 |
cursor = collection.find()
|
34 |
player_frame = pd.DataFrame(cursor)
|
35 |
-
data_cols = player_frame.columns.drop('Player')
|
36 |
-
player_frame[data_cols] = player_frame[data_cols].apply(pd.to_numeric, errors='coerce')
|
37 |
roo_data = player_frame
|
38 |
|
39 |
return roo_data
|
@@ -67,10 +65,10 @@ with tab1:
|
|
67 |
hold_container = st.empty()
|
68 |
|
69 |
with options_container:
|
70 |
-
site_var = st.selectbox("Site", ["DraftKings", "FanDuel"])
|
71 |
|
72 |
with hold_container:
|
73 |
-
hold_display = hold_display
|
74 |
display = hold_display.set_index('Player')
|
75 |
st.dataframe(display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True)
|
76 |
|
|
|
32 |
collection = db["PGA_Range_of_Outcomes"]
|
33 |
cursor = collection.find()
|
34 |
player_frame = pd.DataFrame(cursor)
|
|
|
|
|
35 |
roo_data = player_frame
|
36 |
|
37 |
return roo_data
|
|
|
65 |
hold_container = st.empty()
|
66 |
|
67 |
with options_container:
|
68 |
+
site_var = st.selectbox("Select a Site", ["DraftKings", "FanDuel"])
|
69 |
|
70 |
with hold_container:
|
71 |
+
hold_display = hold_display[hold_display['Site'] == site_var]
|
72 |
display = hold_display.set_index('Player')
|
73 |
st.dataframe(display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(player_roo_format, precision=2), height=750, use_container_width = True)
|
74 |
|