Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -66,6 +66,18 @@ def init_DK_seed_frames():
|
|
| 66 |
|
| 67 |
return DK_seed
|
| 68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
@st.cache_data(ttl = 599)
|
| 70 |
def init_FD_seed_frames():
|
| 71 |
|
|
@@ -78,6 +90,18 @@ def init_FD_seed_frames():
|
|
| 78 |
|
| 79 |
return FD_seed
|
| 80 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
@st.cache_resource(ttl = 301)
|
| 82 |
def init_baselines():
|
| 83 |
sh = gcservice_account.open_by_url('https://docs.google.com/spreadsheets/d/1Yq0vGriWK-bS79e-bD6_u9pqrYE6Yrlbb_wEkmH-ot0/edit#gid=172632260')
|
|
@@ -97,7 +121,17 @@ def init_baselines():
|
|
| 97 |
fd_roo_raw['STDev'] = fd_roo_raw['Median'] / 4
|
| 98 |
fd_raw = fd_roo_raw.dropna(subset=['Median'])
|
| 99 |
|
| 100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
|
| 102 |
@st.cache_data
|
| 103 |
def convert_df(array):
|
|
@@ -154,7 +188,9 @@ def sim_contest(Sim_size, seed_frame, maps_dict, sharp_split, Contest_Size):
|
|
| 154 |
|
| 155 |
DK_seed = init_DK_seed_frames()
|
| 156 |
FD_seed = init_FD_seed_frames()
|
| 157 |
-
|
|
|
|
|
|
|
| 158 |
|
| 159 |
tab1, tab2 = st.tabs(['Contest Sims', 'Data Export'])
|
| 160 |
|
|
@@ -167,15 +203,21 @@ with tab2:
|
|
| 167 |
del st.session_state[key]
|
| 168 |
DK_seed = init_DK_seed_frames()
|
| 169 |
FD_seed = init_FD_seed_frames()
|
| 170 |
-
|
|
|
|
|
|
|
| 171 |
|
| 172 |
-
slate_var1 = st.radio("Which data are you loading?", ('Main Slate', '
|
| 173 |
-
site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'))
|
| 174 |
lineup_num_var = st.number_input("How many lineups do you want to display?", min_value=1, max_value=500, value=10, step=1)
|
| 175 |
|
| 176 |
if site_var1 == 'Draftkings':
|
| 177 |
-
|
| 178 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 179 |
|
| 180 |
player_var1 = st.radio("Do you want a frame with specific Players?", ('Full Slate', 'Specific Players'), key='player_var1')
|
| 181 |
if player_var1 == 'Specific Players':
|
|
@@ -184,8 +226,12 @@ with tab2:
|
|
| 184 |
player_var2 = dk_raw.Player.values.tolist()
|
| 185 |
|
| 186 |
elif site_var1 == 'Fanduel':
|
| 187 |
-
|
| 188 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 189 |
|
| 190 |
player_var1 = st.radio("Do you want a frame with specific Players?", ('Full Slate', 'Specific Players'), key='player_var1')
|
| 191 |
if player_var1 == 'Specific Players':
|
|
@@ -258,15 +304,25 @@ with tab1:
|
|
| 258 |
del st.session_state[key]
|
| 259 |
DK_seed = init_DK_seed_frames()
|
| 260 |
FD_seed = init_FD_seed_frames()
|
| 261 |
-
|
| 262 |
-
|
|
|
|
|
|
|
| 263 |
sim_site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'), key='sim_site_var1')
|
| 264 |
if sim_site_var1 == 'Draftkings':
|
| 265 |
-
|
| 266 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
elif sim_site_var1 == 'Fanduel':
|
| 268 |
-
|
| 269 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 270 |
|
| 271 |
contest_var1 = st.selectbox("What contest size are you simulating?", ('Small', 'Medium', 'Large', 'Custom'))
|
| 272 |
if contest_var1 == 'Small':
|
|
|
|
| 66 |
|
| 67 |
return DK_seed
|
| 68 |
|
| 69 |
+
@st.cache_data(ttl = 600)
|
| 70 |
+
def init_DK_secondary_seed_frames():
|
| 71 |
+
|
| 72 |
+
collection = db["DK_NBA_Secondary_seed_frame"]
|
| 73 |
+
cursor = collection.find()
|
| 74 |
+
|
| 75 |
+
raw_display = pd.DataFrame(list(cursor))
|
| 76 |
+
raw_display = raw_display[['PG', 'SG', 'SF', 'PF', 'C', 'G', 'F', 'FLEX', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
|
| 77 |
+
DK_secondary = raw_display.to_numpy()
|
| 78 |
+
|
| 79 |
+
return DK_secondary
|
| 80 |
+
|
| 81 |
@st.cache_data(ttl = 599)
|
| 82 |
def init_FD_seed_frames():
|
| 83 |
|
|
|
|
| 90 |
|
| 91 |
return FD_seed
|
| 92 |
|
| 93 |
+
@st.cache_data(ttl = 599)
|
| 94 |
+
def init_FD_secondary_seed_frames():
|
| 95 |
+
|
| 96 |
+
collection = db["FD_NBA_Secondary_seed_frame"]
|
| 97 |
+
cursor = collection.find()
|
| 98 |
+
|
| 99 |
+
raw_display = pd.DataFrame(list(cursor))
|
| 100 |
+
raw_display = raw_display[['PG1', 'PG2', 'SG1', 'SG2', 'SF1', 'SF2', 'PF1', 'PF2', 'C1', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']]
|
| 101 |
+
FD_secondary = raw_display.to_numpy()
|
| 102 |
+
|
| 103 |
+
return FD_secondary
|
| 104 |
+
|
| 105 |
@st.cache_resource(ttl = 301)
|
| 106 |
def init_baselines():
|
| 107 |
sh = gcservice_account.open_by_url('https://docs.google.com/spreadsheets/d/1Yq0vGriWK-bS79e-bD6_u9pqrYE6Yrlbb_wEkmH-ot0/edit#gid=172632260')
|
|
|
|
| 121 |
fd_roo_raw['STDev'] = fd_roo_raw['Median'] / 4
|
| 122 |
fd_raw = fd_roo_raw.dropna(subset=['Median'])
|
| 123 |
|
| 124 |
+
dk_secondary_roo_raw = load_display[load_display['site'] == 'Draftkings']
|
| 125 |
+
dk_secondary_roo_raw = dk_secondary_roo_raw[dk_secondary_roo_raw['slate'] == 'Secondary Slate']
|
| 126 |
+
dk_secondary_roo_raw['STDev'] = dk_secondary_roo_raw['Median'] / 4
|
| 127 |
+
dk_secondary = dk_secondary_roo_raw.dropna(subset=['Median'])
|
| 128 |
+
|
| 129 |
+
fd_secondary_roo_raw = load_display[load_display['site'] == 'Fanduel']
|
| 130 |
+
fd_secondary_roo_raw = fd_secondary_roo_raw[fd_secondary_roo_raw['slate'] == 'Secondary Slate']
|
| 131 |
+
fd_secondary_roo_raw['STDev'] = fd_secondary_roo_raw['Median'] / 4
|
| 132 |
+
fd_secondary = fd_secondary_roo_raw.dropna(subset=['Median'])
|
| 133 |
+
|
| 134 |
+
return dk_raw, fd_raw, dk_secondary, fd_secondary
|
| 135 |
|
| 136 |
@st.cache_data
|
| 137 |
def convert_df(array):
|
|
|
|
| 188 |
|
| 189 |
DK_seed = init_DK_seed_frames()
|
| 190 |
FD_seed = init_FD_seed_frames()
|
| 191 |
+
DK_secondary = init_DK_secondary_seed_frames()
|
| 192 |
+
FD_secondary = init_FD_secondary_seed_frames()
|
| 193 |
+
dk_raw, fd_raw, dk_secondary, fd_secondary = init_baselines()
|
| 194 |
|
| 195 |
tab1, tab2 = st.tabs(['Contest Sims', 'Data Export'])
|
| 196 |
|
|
|
|
| 203 |
del st.session_state[key]
|
| 204 |
DK_seed = init_DK_seed_frames()
|
| 205 |
FD_seed = init_FD_seed_frames()
|
| 206 |
+
DK_secondary = init_DK_secondary_seed_frames()
|
| 207 |
+
FD_secondary = init_FD_secondary_seed_frames()
|
| 208 |
+
dk_raw, fd_raw, dk_secondary, fd_secondary = init_baselines()
|
| 209 |
|
| 210 |
+
slate_var1 = st.radio("Which data are you loading?", ('Main Slate', 'Secondary Slate'), key='slate_var1')
|
| 211 |
+
site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'), key='site_var1')
|
| 212 |
lineup_num_var = st.number_input("How many lineups do you want to display?", min_value=1, max_value=500, value=10, step=1)
|
| 213 |
|
| 214 |
if site_var1 == 'Draftkings':
|
| 215 |
+
if slate_var1 == 'Main Slate':
|
| 216 |
+
raw_baselines = dk_raw
|
| 217 |
+
column_names = dk_columns
|
| 218 |
+
elif slate_var1 == 'Secondary Slate':
|
| 219 |
+
raw_baselines = dk_secondary
|
| 220 |
+
column_names = dk_columns
|
| 221 |
|
| 222 |
player_var1 = st.radio("Do you want a frame with specific Players?", ('Full Slate', 'Specific Players'), key='player_var1')
|
| 223 |
if player_var1 == 'Specific Players':
|
|
|
|
| 226 |
player_var2 = dk_raw.Player.values.tolist()
|
| 227 |
|
| 228 |
elif site_var1 == 'Fanduel':
|
| 229 |
+
if slate_var1 == 'Main Slate':
|
| 230 |
+
raw_baselines = fd_raw
|
| 231 |
+
column_names = fd_columns
|
| 232 |
+
elif slate_var1 == 'Secondary Slate':
|
| 233 |
+
raw_baselines = fd_secondary
|
| 234 |
+
column_names = fd_columns
|
| 235 |
|
| 236 |
player_var1 = st.radio("Do you want a frame with specific Players?", ('Full Slate', 'Specific Players'), key='player_var1')
|
| 237 |
if player_var1 == 'Specific Players':
|
|
|
|
| 304 |
del st.session_state[key]
|
| 305 |
DK_seed = init_DK_seed_frames()
|
| 306 |
FD_seed = init_FD_seed_frames()
|
| 307 |
+
DK_secondary = init_DK_secondary_seed_frames()
|
| 308 |
+
FD_secondary = init_FD_secondary_seed_frames()
|
| 309 |
+
dk_raw, fd_raw, dk_secondary, fd_secondary = init_baselines()
|
| 310 |
+
sim_slate_var1 = st.radio("Which data are you loading?", ('Main Slate', 'Secondary Slate'), key='sim_slate_var1')
|
| 311 |
sim_site_var1 = st.radio("What site are you working with?", ('Draftkings', 'Fanduel'), key='sim_site_var1')
|
| 312 |
if sim_site_var1 == 'Draftkings':
|
| 313 |
+
if sim_slate_var1 == 'Main Slate':
|
| 314 |
+
raw_baselines = dk_raw
|
| 315 |
+
column_names = dk_columns
|
| 316 |
+
elif sim_slate_var1 == 'Secondary Slate':
|
| 317 |
+
raw_baselines = dk_secondary
|
| 318 |
+
column_names = dk_columns
|
| 319 |
elif sim_site_var1 == 'Fanduel':
|
| 320 |
+
if sim_slate_var1 == 'Main Slate':
|
| 321 |
+
raw_baselines = fd_raw
|
| 322 |
+
column_names = fd_columns
|
| 323 |
+
elif sim_slate_var1 == 'Secondary Slate':
|
| 324 |
+
raw_baselines = fd_secondary
|
| 325 |
+
column_names = fd_columns
|
| 326 |
|
| 327 |
contest_var1 = st.selectbox("What contest size are you simulating?", ('Small', 'Medium', 'Large', 'Custom'))
|
| 328 |
if contest_var1 == 'Small':
|