Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,7 @@ freq_format = {'Exposure': '{:.2%}', 'Proj Own': '{:.2%}', 'Edge': '{:.2%}'}
|
|
| 54 |
dk_columns = ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4', 'FLEX5', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']
|
| 55 |
fd_columns = ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']
|
| 56 |
|
| 57 |
-
@st.cache_data(ttl =
|
| 58 |
def init_DK_seed_frames():
|
| 59 |
|
| 60 |
collection = db["DK_NFL_SD_seed_frame"]
|
|
@@ -379,13 +379,15 @@ with tab1:
|
|
| 379 |
if sim_site_var1 == 'Draftkings':
|
| 380 |
cpt_working = pd.DataFrame(np.column_stack(np.unique(freq_copy.iloc[:,0:1].values, return_counts=True)),
|
| 381 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
|
|
|
| 382 |
elif sim_site_var1 == 'Fanduel':
|
| 383 |
cpt_working = pd.DataFrame(np.column_stack(np.unique(freq_copy.iloc[:,0:1].values, return_counts=True)),
|
| 384 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
|
|
|
| 385 |
cpt_working['Freq'] = cpt_working['Freq'].astype(int)
|
| 386 |
cpt_working['Position'] = cpt_working['Player'].map(maps_dict['Pos_map'])
|
| 387 |
cpt_working['Salary'] = cpt_working['Player'].map(maps_dict['Salary_map'])
|
| 388 |
-
cpt_working['Proj Own'] = cpt_working['Player'].map(maps_dict['Own_map']) /
|
| 389 |
cpt_working['Exposure'] = cpt_working['Freq']/(1000)
|
| 390 |
cpt_working['Edge'] = cpt_working['Exposure'] - cpt_working['Proj Own']
|
| 391 |
cpt_working['Team'] = cpt_working['Player'].map(maps_dict['Team_map'])
|
|
@@ -394,16 +396,18 @@ with tab1:
|
|
| 394 |
if sim_site_var1 == 'Draftkings':
|
| 395 |
flex_working = pd.DataFrame(np.column_stack(np.unique(freq_copy.iloc[:,1:6].values, return_counts=True)),
|
| 396 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
|
|
|
| 397 |
elif sim_site_var1 == 'Fanduel':
|
| 398 |
flex_working = pd.DataFrame(np.column_stack(np.unique(freq_copy.iloc[:,1:5].values, return_counts=True)),
|
| 399 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
|
|
|
| 400 |
flex_working['Freq'] = flex_working['Freq'].astype(int)
|
| 401 |
flex_working['Position'] = flex_working['Player'].map(maps_dict['Pos_map'])
|
| 402 |
if sim_site_var1 == 'Draftkings':
|
| 403 |
flex_working['Salary'] = flex_working['Player'].map(maps_dict['Salary_map']) / 1.5
|
| 404 |
elif sim_site_var1 == 'Fanduel':
|
| 405 |
flex_working['Salary'] = flex_working['Player'].map(maps_dict['Salary_map'])
|
| 406 |
-
flex_working['Proj Own'] = (flex_working['Player'].map(maps_dict['Own_map']) / 100) - (flex_working['Player'].map(maps_dict['Own_map']) /
|
| 407 |
flex_working['Exposure'] = flex_working['Freq']/(1000)
|
| 408 |
flex_working['Edge'] = flex_working['Exposure'] - flex_working['Proj Own']
|
| 409 |
flex_working['Team'] = flex_working['Player'].map(maps_dict['Team_map'])
|
|
|
|
| 54 |
dk_columns = ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4', 'FLEX5', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']
|
| 55 |
fd_columns = ['CPT', 'FLEX1', 'FLEX2', 'FLEX3', 'FLEX4', 'salary', 'proj', 'Team', 'Team_count', 'Secondary', 'Secondary_count', 'Own']
|
| 56 |
|
| 57 |
+
@st.cache_data(ttl = 599)
|
| 58 |
def init_DK_seed_frames():
|
| 59 |
|
| 60 |
collection = db["DK_NFL_SD_seed_frame"]
|
|
|
|
| 379 |
if sim_site_var1 == 'Draftkings':
|
| 380 |
cpt_working = pd.DataFrame(np.column_stack(np.unique(freq_copy.iloc[:,0:1].values, return_counts=True)),
|
| 381 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
| 382 |
+
cpt_own_div = 600
|
| 383 |
elif sim_site_var1 == 'Fanduel':
|
| 384 |
cpt_working = pd.DataFrame(np.column_stack(np.unique(freq_copy.iloc[:,0:1].values, return_counts=True)),
|
| 385 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
| 386 |
+
cpt_own_div = 500
|
| 387 |
cpt_working['Freq'] = cpt_working['Freq'].astype(int)
|
| 388 |
cpt_working['Position'] = cpt_working['Player'].map(maps_dict['Pos_map'])
|
| 389 |
cpt_working['Salary'] = cpt_working['Player'].map(maps_dict['Salary_map'])
|
| 390 |
+
cpt_working['Proj Own'] = cpt_working['Player'].map(maps_dict['Own_map']) / cpt_own_div
|
| 391 |
cpt_working['Exposure'] = cpt_working['Freq']/(1000)
|
| 392 |
cpt_working['Edge'] = cpt_working['Exposure'] - cpt_working['Proj Own']
|
| 393 |
cpt_working['Team'] = cpt_working['Player'].map(maps_dict['Team_map'])
|
|
|
|
| 396 |
if sim_site_var1 == 'Draftkings':
|
| 397 |
flex_working = pd.DataFrame(np.column_stack(np.unique(freq_copy.iloc[:,1:6].values, return_counts=True)),
|
| 398 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
| 399 |
+
cpt_own_div = 600
|
| 400 |
elif sim_site_var1 == 'Fanduel':
|
| 401 |
flex_working = pd.DataFrame(np.column_stack(np.unique(freq_copy.iloc[:,1:5].values, return_counts=True)),
|
| 402 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
| 403 |
+
cpt_own_div = 500
|
| 404 |
flex_working['Freq'] = flex_working['Freq'].astype(int)
|
| 405 |
flex_working['Position'] = flex_working['Player'].map(maps_dict['Pos_map'])
|
| 406 |
if sim_site_var1 == 'Draftkings':
|
| 407 |
flex_working['Salary'] = flex_working['Player'].map(maps_dict['Salary_map']) / 1.5
|
| 408 |
elif sim_site_var1 == 'Fanduel':
|
| 409 |
flex_working['Salary'] = flex_working['Player'].map(maps_dict['Salary_map'])
|
| 410 |
+
flex_working['Proj Own'] = (flex_working['Player'].map(maps_dict['Own_map']) / 100) - (flex_working['Player'].map(maps_dict['Own_map']) / cpt_own_div)
|
| 411 |
flex_working['Exposure'] = flex_working['Freq']/(1000)
|
| 412 |
flex_working['Edge'] = flex_working['Exposure'] - flex_working['Proj Own']
|
| 413 |
flex_working['Team'] = flex_working['Player'].map(maps_dict['Team_map'])
|