Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -138,13 +138,16 @@ def convert_df_to_csv(df):
|
|
138 |
return df.to_csv().encode('utf-8')
|
139 |
|
140 |
gamelog_table = init_baselines()
|
141 |
-
total_teams = gamelog_table.Team.values.tolist()
|
|
|
142 |
|
143 |
col1, col2 = st.columns([1, 9])
|
144 |
with col1:
|
145 |
if st.button("Reset Data", key='reset1'):
|
146 |
st.cache_data.clear()
|
147 |
gamelog_table = init_baselines()
|
|
|
|
|
148 |
|
149 |
split_var1 = st.radio("What table would you like to view?", ('Season Logs', 'Gamelogs'), key='split_var1')
|
150 |
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
@@ -153,10 +156,23 @@ with col1:
|
|
153 |
team_var1 = st.multiselect('Which teams would you like to include in the tables?', options = total_teams, key='team_var1')
|
154 |
elif split_var2 == 'All':
|
155 |
team_var1 = total_teams
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
156 |
|
157 |
with col2:
|
158 |
if split_var1 == 'Season Logs':
|
159 |
display = st.container()
|
|
|
|
|
160 |
gamelog_table = gamelog_table[gamelog_table['Team'].isin(team_var1)]
|
161 |
season_long_table = seasonlong_build(gamelog_table)
|
162 |
season_long_table = season_long_table.set_index('Player')
|
@@ -177,6 +193,10 @@ with col2:
|
|
177 |
)
|
178 |
with bottom_menu[0]:
|
179 |
st.markdown(f"Page **{current_page}** of **{total_pages}** ")
|
|
|
|
|
|
|
|
|
180 |
gamelog_table = gamelog_table[gamelog_table['Team'].isin(team_var1)]
|
181 |
gamelog_table = gamelog_table.set_index('Player')
|
182 |
pages = split_frame(gamelog_table, batch_size)
|
|
|
138 |
return df.to_csv().encode('utf-8')
|
139 |
|
140 |
gamelog_table = init_baselines()
|
141 |
+
total_teams = gamelog_table.Team.values.unique().tolist()
|
142 |
+
total_dates = gamelog_table.Date.values.unique().tolist()
|
143 |
|
144 |
col1, col2 = st.columns([1, 9])
|
145 |
with col1:
|
146 |
if st.button("Reset Data", key='reset1'):
|
147 |
st.cache_data.clear()
|
148 |
gamelog_table = init_baselines()
|
149 |
+
total_teams = gamelog_table.Team.values.unique().tolist()
|
150 |
+
total_dates = gamelog_table.Date.values.unique().tolist()
|
151 |
|
152 |
split_var1 = st.radio("What table would you like to view?", ('Season Logs', 'Gamelogs'), key='split_var1')
|
153 |
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
|
|
156 |
team_var1 = st.multiselect('Which teams would you like to include in the tables?', options = total_teams, key='team_var1')
|
157 |
elif split_var2 == 'All':
|
158 |
team_var1 = total_teams
|
159 |
+
|
160 |
+
split_var3 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Dates'), key='split_var3')
|
161 |
+
|
162 |
+
if split_var3 == 'Specific Dates':
|
163 |
+
low_date = st.date_input('Min Date:', value=None, format="YYYY-MM-DD", key='low_date')
|
164 |
+
high_date = st.date_input('Max Date:', value=None, format="YYYY-MM-DD", key='high_date')
|
165 |
+
elif split_var3 == 'All':
|
166 |
+
low_date = min(total_dates)
|
167 |
+
high_date = max(total_dates)
|
168 |
+
|
169 |
+
min_var1 = st.slider("Is there a certain minutes range you want to view?", 0, 60, (0, 60), key='min_var1')
|
170 |
|
171 |
with col2:
|
172 |
if split_var1 == 'Season Logs':
|
173 |
display = st.container()
|
174 |
+
gamelog_table = gamelog_table[gamelog_table['Min'] >= min_var1[0]]
|
175 |
+
gamelog_table = gamelog_table[gamelog_table['Min'] <= min_var1[1]]
|
176 |
gamelog_table = gamelog_table[gamelog_table['Team'].isin(team_var1)]
|
177 |
season_long_table = seasonlong_build(gamelog_table)
|
178 |
season_long_table = season_long_table.set_index('Player')
|
|
|
193 |
)
|
194 |
with bottom_menu[0]:
|
195 |
st.markdown(f"Page **{current_page}** of **{total_pages}** ")
|
196 |
+
gamelog_table = gamelog_table[gamelog_table['Date'] >= low_date]
|
197 |
+
gamelog_table = gamelog_table[gamelog_table['Date'] <= high_date]
|
198 |
+
gamelog_table = gamelog_table[gamelog_table['Min'] >= min_var1[0]]
|
199 |
+
gamelog_table = gamelog_table[gamelog_table['Min'] <= min_var1[1]]
|
200 |
gamelog_table = gamelog_table[gamelog_table['Team'].isin(team_var1)]
|
201 |
gamelog_table = gamelog_table.set_index('Player')
|
202 |
pages = split_frame(gamelog_table, batch_size)
|