Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -126,12 +126,14 @@ with tab1:
|
|
126 |
with col2:
|
127 |
if st.button("Load Seed Frame", key='seed_frame_load'):
|
128 |
if site_var1 == 'Draftkings':
|
|
|
129 |
DK_seed = init_DK_seed_frame()
|
130 |
DK_seed_parse = DK_seed[DK_seed['Team'].isin(team_var2)]
|
131 |
DK_seed_parse = DK_seed_parse[DK_seed_parse['Team_count'].isin(stack_var2)]
|
132 |
-
|
133 |
-
st.session_state.
|
134 |
-
st.session_state.
|
|
|
135 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
136 |
st.session_state.data_export_freq['Freq'] = st.session_state.data_export_freq['Freq'].astype(int)
|
137 |
st.session_state.data_export_freq['Exposure'] = st.session_state.data_export_freq['Freq']/(len(DK_seed_parse['Team']))
|
@@ -143,18 +145,24 @@ with tab1:
|
|
143 |
file_name='MLB_optimals_export.csv',
|
144 |
mime='text/csv',
|
145 |
)
|
146 |
-
st.
|
147 |
-
|
|
|
|
|
|
|
|
|
|
|
148 |
elif site_var1 == 'Fanduel':
|
149 |
FD_seed = init_DK_seed_frame()
|
150 |
FD_seed_parse = FD_seed[FD_seed['Team'].isin(team_var2)]
|
151 |
FD_seed_parse = FD_seed_parse[FD_seed_parse['Team_count'].isin(stack_var2)]
|
152 |
-
|
153 |
-
st.session_state.
|
154 |
-
st.session_state.
|
|
|
155 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
156 |
st.session_state.data_export_freq['Freq'] = st.session_state.data_export_freq['Freq'].astype(int)
|
157 |
-
st.session_state.data_export_freq['Exposure'] = st.session_state.data_export_freq['Freq']/(len(
|
158 |
|
159 |
if 'data_export' in st.session_state:
|
160 |
st.download_button(
|
@@ -163,8 +171,12 @@ with tab1:
|
|
163 |
file_name='MLB_optimals_export.csv',
|
164 |
mime='text/csv',
|
165 |
)
|
166 |
-
st.
|
167 |
-
|
|
|
|
|
|
|
|
|
168 |
|
169 |
with tab2:
|
170 |
col1, col2 = st.columns([1, 7])
|
|
|
126 |
with col2:
|
127 |
if st.button("Load Seed Frame", key='seed_frame_load'):
|
128 |
if site_var1 == 'Draftkings':
|
129 |
+
|
130 |
DK_seed = init_DK_seed_frame()
|
131 |
DK_seed_parse = DK_seed[DK_seed['Team'].isin(team_var2)]
|
132 |
DK_seed_parse = DK_seed_parse[DK_seed_parse['Team_count'].isin(stack_var2)]
|
133 |
+
data_export_display = DK_seed_parse.head(1000)
|
134 |
+
st.session_state.data_export_display = data_export_display.copy()
|
135 |
+
st.session_state.data_export = data_export_display.copy()
|
136 |
+
st.session_state.data_export_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.data_export_display.iloc[:,0:9].values, return_counts=True)),
|
137 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
138 |
st.session_state.data_export_freq['Freq'] = st.session_state.data_export_freq['Freq'].astype(int)
|
139 |
st.session_state.data_export_freq['Exposure'] = st.session_state.data_export_freq['Freq']/(len(DK_seed_parse['Team']))
|
|
|
145 |
file_name='MLB_optimals_export.csv',
|
146 |
mime='text/csv',
|
147 |
)
|
148 |
+
with st.container():
|
149 |
+
if 'data_export_display' in st.session.state:
|
150 |
+
st.dataframe(st.session_state.data_export_display.style.format(precision=2), height=500, use_container_width=True)
|
151 |
+
with st.container():
|
152 |
+
if 'data_export_freq' in st.session.state:
|
153 |
+
st.dataframe(st.session_state.data_export_freq.style.format(percentages_format, precision=2), height=500, use_container_width=True)
|
154 |
+
|
155 |
elif site_var1 == 'Fanduel':
|
156 |
FD_seed = init_DK_seed_frame()
|
157 |
FD_seed_parse = FD_seed[FD_seed['Team'].isin(team_var2)]
|
158 |
FD_seed_parse = FD_seed_parse[FD_seed_parse['Team_count'].isin(stack_var2)]
|
159 |
+
data_export_display = DK_seed_parse.head(1000)
|
160 |
+
st.session_state.data_export_display = data_export_display.copy()
|
161 |
+
st.session_state.data_export = data_export_display.copy()
|
162 |
+
st.session_state.data_export_freq = pd.DataFrame(np.column_stack(np.unique(st.session_state.data_export_display.iloc[:,0:8].values, return_counts=True)),
|
163 |
columns=['Player','Freq']).sort_values('Freq', ascending=False).reset_index(drop=True)
|
164 |
st.session_state.data_export_freq['Freq'] = st.session_state.data_export_freq['Freq'].astype(int)
|
165 |
+
st.session_state.data_export_freq['Exposure'] = st.session_state.data_export_freq['Freq']/(len(DK_seed_parse['Team']))
|
166 |
|
167 |
if 'data_export' in st.session_state:
|
168 |
st.download_button(
|
|
|
171 |
file_name='MLB_optimals_export.csv',
|
172 |
mime='text/csv',
|
173 |
)
|
174 |
+
with st.container():
|
175 |
+
if 'data_export_display' in st.session.state:
|
176 |
+
st.dataframe(st.session_state.data_export_display.style.format(precision=2), height=500, use_container_width=True)
|
177 |
+
with st.container():
|
178 |
+
if 'data_export_freq' in st.session.state:
|
179 |
+
st.dataframe(st.session_state.data_export_freq.style.format(percentages_format, precision=2), height=500, use_container_width=True)
|
180 |
|
181 |
with tab2:
|
182 |
col1, col2 = st.columns([1, 7])
|