Spaces:
Running
Running
James McCool
commited on
Commit
·
e54a8b1
1
Parent(s):
792293e
Refactor app.py: Enhance data initialization and timestamp handling. Updated init_baselines to return both processed data and timestamp, ensuring better data management. Adjusted references to the updated function throughout the code, including site selection logic and display updates.
Browse files
app.py
CHANGED
@@ -32,14 +32,18 @@ def init_baselines():
|
|
32 |
collection = db["PGA_Range_of_Outcomes"]
|
33 |
cursor = collection.find()
|
34 |
player_frame = pd.DataFrame(cursor)
|
35 |
-
roo_data = player_frame
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
def convert_df_to_csv(df):
|
40 |
return df.to_csv().encode('utf-8')
|
41 |
|
42 |
-
roo_data = init_baselines()
|
43 |
hold_display = roo_data
|
44 |
lineup_display = []
|
45 |
check_list = []
|
@@ -54,18 +58,19 @@ with tab1:
|
|
54 |
# Clear values from *all* all in-memory and on-disk data caches:
|
55 |
# i.e. clear values from both square and cube
|
56 |
st.cache_data.clear()
|
57 |
-
roo_data = init_baselines()
|
58 |
hold_display = roo_data
|
59 |
lineup_display = []
|
60 |
check_list = []
|
61 |
rand_player = 0
|
62 |
boost_player = 0
|
63 |
salaryCut = 0
|
|
|
64 |
options_container = st.empty()
|
65 |
hold_container = st.empty()
|
66 |
|
67 |
with options_container:
|
68 |
-
site_var = st.selectbox("Select a Site", ["
|
69 |
|
70 |
with hold_container:
|
71 |
display = hold_display[hold_display['Site'] == site_var]
|
|
|
32 |
collection = db["PGA_Range_of_Outcomes"]
|
33 |
cursor = collection.find()
|
34 |
player_frame = pd.DataFrame(cursor)
|
|
|
35 |
|
36 |
+
timestamp = player_frame['Timestamp'][0]
|
37 |
+
|
38 |
+
roo_data = player_frame.drop(columns=['_id', 'index', 'Timestamp'])
|
39 |
+
roo_data['Salary'] = roo_data['Salary'].astype(int)
|
40 |
+
|
41 |
+
return roo_data, timestamp
|
42 |
|
43 |
def convert_df_to_csv(df):
|
44 |
return df.to_csv().encode('utf-8')
|
45 |
|
46 |
+
roo_data, timestamp = init_baselines()
|
47 |
hold_display = roo_data
|
48 |
lineup_display = []
|
49 |
check_list = []
|
|
|
58 |
# Clear values from *all* all in-memory and on-disk data caches:
|
59 |
# i.e. clear values from both square and cube
|
60 |
st.cache_data.clear()
|
61 |
+
roo_data, timestamp = init_baselines()
|
62 |
hold_display = roo_data
|
63 |
lineup_display = []
|
64 |
check_list = []
|
65 |
rand_player = 0
|
66 |
boost_player = 0
|
67 |
salaryCut = 0
|
68 |
+
st.write(timestamp)
|
69 |
options_container = st.empty()
|
70 |
hold_container = st.empty()
|
71 |
|
72 |
with options_container:
|
73 |
+
site_var = st.selectbox("Select a Site", ["Draftkings", "FanDuel"])
|
74 |
|
75 |
with hold_container:
|
76 |
display = hold_display[hold_display['Site'] == site_var]
|