Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -58,26 +58,51 @@ def load_overall_stats():
|
|
58 |
|
59 |
return dk_raw, fd_raw
|
60 |
|
61 |
-
dk_raw, fd_raw = load_overall_stats()
|
62 |
-
|
63 |
-
tab1, tab2 = st.tabs(["Range of Outcomes Model", "Optimizer (Coming soon)"])
|
64 |
-
|
65 |
def convert_df_to_csv(df):
|
66 |
return df.to_csv().encode('utf-8')
|
67 |
|
68 |
-
|
|
|
|
|
69 |
|
|
|
|
|
70 |
col1, col2 = st.columns([1, 5])
|
71 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
72 |
with col1:
|
73 |
if st.button("Load/Reset Data", key='reset1'):
|
74 |
st.cache_data.clear()
|
75 |
dk_raw, fd_raw = load_overall_stats()
|
|
|
|
|
|
|
76 |
site_var1 = st.radio("What table would you like to display?", ('Draftkings', 'Fanduel'), key='site_var1')
|
77 |
if site_var1 == 'Draftkings':
|
78 |
-
|
|
|
|
|
|
|
79 |
elif site_var1 == 'Fanduel':
|
80 |
-
|
|
|
|
|
|
|
81 |
split_var1 = st.radio("Are you running the full slate or crtain games?", ('Full Slate Run', 'Specific Games'), key='split_var1')
|
82 |
if split_var1 == 'Specific Games':
|
83 |
team_var1 = st.multiselect('Which teams would you like to include in the ROO?', options = raw_baselines['Team'].unique(), key='team_var1')
|
@@ -101,10 +126,10 @@ with tab1:
|
|
101 |
team_dict = dict(zip(working_roo.Player, working_roo.Team))
|
102 |
total_sims = 1000
|
103 |
|
104 |
-
flex_file = working_roo[['Player', 'Position', 'Salary', 'Median']]
|
105 |
flex_file.rename(columns={"Agg": "Median"}, inplace = True)
|
106 |
-
flex_file['Floor'] = flex_file['Median']
|
107 |
-
flex_file['Ceiling'] = flex_file['Median'] + (flex_file['
|
108 |
flex_file['STD'] = (flex_file['Median']/4)
|
109 |
flex_file = flex_file[['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD']]
|
110 |
hold_file = flex_file
|
|
|
58 |
|
59 |
return dk_raw, fd_raw
|
60 |
|
|
|
|
|
|
|
|
|
61 |
def convert_df_to_csv(df):
|
62 |
return df.to_csv().encode('utf-8')
|
63 |
|
64 |
+
dk_raw, fd_raw = load_overall_stats()
|
65 |
+
|
66 |
+
tab1, tab2 = st.tabs(['Uploads and Info', 'Range of Outcomes'])
|
67 |
|
68 |
+
with tab1:
|
69 |
+
st.info("The Projections file can have any columns in any order, but must contain columns explicitly named: 'Player', 'Salary', 'Position', 'Team', 'Opp', 'Minutes', 'Median', 'Own'.")
|
70 |
col1, col2 = st.columns([1, 5])
|
71 |
|
72 |
+
with col1:
|
73 |
+
proj_file = st.file_uploader("Upload Projections File", key = 'proj_uploader')
|
74 |
+
|
75 |
+
if proj_file is not None:
|
76 |
+
try:
|
77 |
+
proj_dataframe = pd.read_csv(proj_file)
|
78 |
+
except:
|
79 |
+
proj_dataframe = pd.read_excel(proj_file)
|
80 |
+
with col2:
|
81 |
+
if proj_file is not None:
|
82 |
+
st.dataframe(proj_dataframe.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
83 |
+
|
84 |
+
with tab2:
|
85 |
+
|
86 |
+
col1, col2 = st.columns([1, 9])
|
87 |
+
|
88 |
with col1:
|
89 |
if st.button("Load/Reset Data", key='reset1'):
|
90 |
st.cache_data.clear()
|
91 |
dk_raw, fd_raw = load_overall_stats()
|
92 |
+
for key in st.session_state.keys():
|
93 |
+
del st.session_state[key]
|
94 |
+
slate_var1 = st.radio("Which data are you loading?", ('Paydirt', 'User'), key='slate_var1')
|
95 |
site_var1 = st.radio("What table would you like to display?", ('Draftkings', 'Fanduel'), key='site_var1')
|
96 |
if site_var1 == 'Draftkings':
|
97 |
+
if slate_var1 == 'User':
|
98 |
+
raw_baselines = proj_dataframe
|
99 |
+
elif slate_var1 != 'User':
|
100 |
+
raw_baselines = dk_raw
|
101 |
elif site_var1 == 'Fanduel':
|
102 |
+
if slate_var1 == 'User':
|
103 |
+
raw_baselines = proj_dataframe
|
104 |
+
elif slate_var1 != 'User':
|
105 |
+
raw_baselines = fd_raw
|
106 |
split_var1 = st.radio("Are you running the full slate or crtain games?", ('Full Slate Run', 'Specific Games'), key='split_var1')
|
107 |
if split_var1 == 'Specific Games':
|
108 |
team_var1 = st.multiselect('Which teams would you like to include in the ROO?', options = raw_baselines['Team'].unique(), key='team_var1')
|
|
|
126 |
team_dict = dict(zip(working_roo.Player, working_roo.Team))
|
127 |
total_sims = 1000
|
128 |
|
129 |
+
flex_file = working_roo[['Player', 'Position', 'Salary', 'Median', 'Minutes']]
|
130 |
flex_file.rename(columns={"Agg": "Median"}, inplace = True)
|
131 |
+
flex_file['Floor'] = (flex_file['Median'] * .15) + (flex_file['Minutes'] * .15)
|
132 |
+
flex_file['Ceiling'] = flex_file['Median'] + (flex_file['Median'] * 1.85) + (flex_file['Minutes'] * .15)
|
133 |
flex_file['STD'] = (flex_file['Median']/4)
|
134 |
flex_file = flex_file[['Player', 'Position', 'Salary', 'Floor', 'Median', 'Ceiling', 'STD']]
|
135 |
hold_file = flex_file
|