Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -181,7 +181,7 @@ def convert_df_to_csv(df):
|
|
| 181 |
|
| 182 |
gamelog_table = init_baselines()
|
| 183 |
basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
|
| 184 |
-
basic_season_cols = ['
|
| 185 |
data_cols = ['Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 186 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 187 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
|
@@ -205,7 +205,7 @@ with tab1:
|
|
| 205 |
st.cache_data.clear()
|
| 206 |
gamelog_table = init_baselines()
|
| 207 |
basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
|
| 208 |
-
basic_season_cols = ['
|
| 209 |
data_cols = ['Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 210 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 211 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
|
@@ -278,8 +278,8 @@ with tab1:
|
|
| 278 |
elif split_var1 == 'Gamelogs':
|
| 279 |
choose_cols = st.container()
|
| 280 |
with choose_cols:
|
| 281 |
-
|
| 282 |
-
|
| 283 |
working_data = working_data[working_data['Date'] >= low_date]
|
| 284 |
working_data = working_data[working_data['Date'] <= high_date]
|
| 285 |
working_data = working_data[working_data['Min'] >= min_var1[0]]
|
|
@@ -287,7 +287,7 @@ with tab1:
|
|
| 287 |
working_data = working_data[working_data['Team'].isin(team_var1)]
|
| 288 |
working_data = working_data[working_data['Player'].isin(player_var1)]
|
| 289 |
working_data = working_data.reset_index(drop=True)
|
| 290 |
-
gamelog_data = working_data.reindex(
|
| 291 |
display = st.container()
|
| 292 |
|
| 293 |
bottom_menu = st.columns((4, 1, 1))
|
|
@@ -320,6 +320,16 @@ with tab2:
|
|
| 320 |
if st.button("Reset Data", key='reset2'):
|
| 321 |
st.cache_data.clear()
|
| 322 |
gamelog_table = init_baselines()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 323 |
indv_teams = gamelog_table.drop_duplicates(subset='Team')
|
| 324 |
total_teams = indv_teams.Team.values.tolist()
|
| 325 |
indv_players = gamelog_table.drop_duplicates(subset='Player')
|
|
@@ -392,6 +402,16 @@ with tab3:
|
|
| 392 |
if st.button("Reset Data", key='reset3'):
|
| 393 |
st.cache_data.clear()
|
| 394 |
gamelog_table = init_baselines()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 395 |
indv_teams = gamelog_table.drop_duplicates(subset='Team')
|
| 396 |
total_teams = indv_teams.Team.values.tolist()
|
| 397 |
indv_players = gamelog_table.drop_duplicates(subset='Player')
|
|
@@ -417,6 +437,11 @@ with tab3:
|
|
| 417 |
min_var3 = st.slider("Is there a certain minutes range you want to view?", 0, 60, (0, 60), key='min_var3')
|
| 418 |
|
| 419 |
with col2:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 420 |
working_data = gamelog_table
|
| 421 |
working_data = working_data[gamelog_table['Date'] >= low_date3]
|
| 422 |
working_data = working_data[gamelog_table['Date'] <= high_date3]
|
|
@@ -432,7 +457,8 @@ with tab3:
|
|
| 432 |
if disp_var3 == 'Fantasy':
|
| 433 |
gamelog_display = working_data[['Player', 'Pos', 'Team', 'Opp', 'Date', 'Min', 'Fantasy', 'FD_Fantasy']]
|
| 434 |
elif disp_var3 == 'Stats':
|
| 435 |
-
|
|
|
|
| 436 |
gamelog_display['Avg_Fantasy'] = gamelog_display['Player'].map(fantasy_dict)
|
| 437 |
gamelog_display['Avg_FD_Fantasy'] = gamelog_display['Player'].map(fd_fantasy_dict)
|
| 438 |
display = st.container()
|
|
|
|
| 181 |
|
| 182 |
gamelog_table = init_baselines()
|
| 183 |
basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
|
| 184 |
+
basic_season_cols = ['Pos', 'Team', 'Min']
|
| 185 |
data_cols = ['Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 186 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 187 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
|
|
|
| 205 |
st.cache_data.clear()
|
| 206 |
gamelog_table = init_baselines()
|
| 207 |
basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
|
| 208 |
+
basic_season_cols = ['Pos', 'Team', 'Min']
|
| 209 |
data_cols = ['Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 210 |
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 211 |
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
|
|
|
| 278 |
elif split_var1 == 'Gamelogs':
|
| 279 |
choose_cols = st.container()
|
| 280 |
with choose_cols:
|
| 281 |
+
choose_disp_gamelog = st.multiselect('Which stats would you like to view?', options = data_cols, default = data_cols, key='col_display')
|
| 282 |
+
gamelog_disp_stats = basic_cols + choose_disp_gamelog
|
| 283 |
working_data = working_data[working_data['Date'] >= low_date]
|
| 284 |
working_data = working_data[working_data['Date'] <= high_date]
|
| 285 |
working_data = working_data[working_data['Min'] >= min_var1[0]]
|
|
|
|
| 287 |
working_data = working_data[working_data['Team'].isin(team_var1)]
|
| 288 |
working_data = working_data[working_data['Player'].isin(player_var1)]
|
| 289 |
working_data = working_data.reset_index(drop=True)
|
| 290 |
+
gamelog_data = working_data.reindex(gamelog_disp_stats,axis="columns")
|
| 291 |
display = st.container()
|
| 292 |
|
| 293 |
bottom_menu = st.columns((4, 1, 1))
|
|
|
|
| 320 |
if st.button("Reset Data", key='reset2'):
|
| 321 |
st.cache_data.clear()
|
| 322 |
gamelog_table = init_baselines()
|
| 323 |
+
basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
|
| 324 |
+
basic_season_cols = ['Pos', 'Team', 'Min']
|
| 325 |
+
data_cols = ['Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 326 |
+
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 327 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 328 |
+
'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 329 |
+
season_data_cols = ['Touches', 'Touch/Min', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A',
|
| 330 |
+
'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 331 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 332 |
+
'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 333 |
indv_teams = gamelog_table.drop_duplicates(subset='Team')
|
| 334 |
total_teams = indv_teams.Team.values.tolist()
|
| 335 |
indv_players = gamelog_table.drop_duplicates(subset='Player')
|
|
|
|
| 402 |
if st.button("Reset Data", key='reset3'):
|
| 403 |
st.cache_data.clear()
|
| 404 |
gamelog_table = init_baselines()
|
| 405 |
+
basic_cols = ['Player', 'Pos', 'Team', 'Opp', 'Season', 'Date', 'Matchup', 'Min']
|
| 406 |
+
basic_season_cols = ['Pos', 'Team', 'Min']
|
| 407 |
+
data_cols = ['Touches', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M',
|
| 408 |
+
'FG3A', 'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 409 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 410 |
+
'Rebound%', 'Assists/Pass', 'Touch_per_min', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 411 |
+
season_data_cols = ['Touches', 'Touch/Min', 'Pts', 'FGM', 'FGA', 'FG%', 'FG3M', 'FG3A',
|
| 412 |
+
'FG3%', 'FTM', 'FTA', 'FT%', 'OREB Chance', 'OREB', 'DREB Chance', 'DREB', 'REB Chance', 'REB',
|
| 413 |
+
'Passes', 'Alt Assists', 'FT Assists', 'Assists', 'Stl', 'Blk', 'Tov', 'PF', 'DD', 'TD', 'Fantasy', 'FD_Fantasy',
|
| 414 |
+
'Rebound%', 'Assists/Pass', 'Fantasy/Touch', 'FD Fantasy/Touch']
|
| 415 |
indv_teams = gamelog_table.drop_duplicates(subset='Team')
|
| 416 |
total_teams = indv_teams.Team.values.tolist()
|
| 417 |
indv_players = gamelog_table.drop_duplicates(subset='Player')
|
|
|
|
| 437 |
min_var3 = st.slider("Is there a certain minutes range you want to view?", 0, 60, (0, 60), key='min_var3')
|
| 438 |
|
| 439 |
with col2:
|
| 440 |
+
if disp_var3 == 'Stats':
|
| 441 |
+
choose_cols = st.container()
|
| 442 |
+
with choose_cols:
|
| 443 |
+
choose_disp_matchup = st.multiselect('Which stats would you like to view?', options = data_cols, default = data_cols, key='col_display')
|
| 444 |
+
matchup_disp_stats = basic_cols + choose_disp_matchup
|
| 445 |
working_data = gamelog_table
|
| 446 |
working_data = working_data[gamelog_table['Date'] >= low_date3]
|
| 447 |
working_data = working_data[gamelog_table['Date'] <= high_date3]
|
|
|
|
| 457 |
if disp_var3 == 'Fantasy':
|
| 458 |
gamelog_display = working_data[['Player', 'Pos', 'Team', 'Opp', 'Date', 'Min', 'Fantasy', 'FD_Fantasy']]
|
| 459 |
elif disp_var3 == 'Stats':
|
| 460 |
+
gamelog_data = working_data.reindex(matchup_disp_stats,axis="columns")
|
| 461 |
+
gamelog_display = gamelog_data
|
| 462 |
gamelog_display['Avg_Fantasy'] = gamelog_display['Player'].map(fantasy_dict)
|
| 463 |
gamelog_display['Avg_FD_Fantasy'] = gamelog_display['Player'].map(fd_fantasy_dict)
|
| 464 |
display = st.container()
|