Spaces:
Running
Running
James McCool
commited on
Commit
·
a138059
1
Parent(s):
0e9c889
Refactor team win projections display and sorting
Browse files
app.py
CHANGED
@@ -39,8 +39,6 @@ gcservice_account = init_conn()
|
|
39 |
|
40 |
master_hold = 'https://docs.google.com/spreadsheets/d/1D526UlXmrz-8qxVcUKrA-u7f6FftUiBufxDnzQv980k/edit#gid=791804525'
|
41 |
|
42 |
-
team_format = {'2B': '{:.2%}', 'HR': '{:.2%}', 'SB': '{:.2%}', 'P_SO': '{:.2%}', 'P_H': '{:.2%}', 'P_R': '{:.2%}',
|
43 |
-
'P_HR': '{:.2%}', 'P_BB': '{:.2%}'}
|
44 |
|
45 |
sim_format = {'Top_finish': '{:.2%}', 'Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}'}
|
46 |
|
@@ -80,9 +78,10 @@ with tab1:
|
|
80 |
total_teams = pitcher_proj['Team'].values.tolist()
|
81 |
raw_frame = wins_proj.copy()
|
82 |
export_frame_team = raw_frame[['Team', '2B', 'HR', 'SB', 'P_SO', 'P_H', 'P_R', 'P_HR', 'P_BB', 'LY Added', 'Added', 'LY Adj Wins', 'Adj Wins', 'Vegas', 'Proj wins', 'Diff']]
|
|
|
83 |
disp_frame = raw_frame[['Team', '2B', 'HR', 'SB', 'P_SO', 'P_H', 'P_R', 'P_HR', 'P_BB', 'LY Added', 'Added', 'LY Adj Wins', 'Adj Wins', 'Vegas', 'Proj wins', 'Diff']]
|
84 |
-
st.dataframe(disp_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(team_format, precision=2), height = 1000, use_container_width = True)
|
85 |
|
|
|
86 |
|
87 |
st.download_button(
|
88 |
label="Export Team Win Projections",
|
|
|
39 |
|
40 |
master_hold = 'https://docs.google.com/spreadsheets/d/1D526UlXmrz-8qxVcUKrA-u7f6FftUiBufxDnzQv980k/edit#gid=791804525'
|
41 |
|
|
|
|
|
42 |
|
43 |
sim_format = {'Top_finish': '{:.2%}', 'Top_5_finish': '{:.2%}', 'Top_10_finish': '{:.2%}'}
|
44 |
|
|
|
78 |
total_teams = pitcher_proj['Team'].values.tolist()
|
79 |
raw_frame = wins_proj.copy()
|
80 |
export_frame_team = raw_frame[['Team', '2B', 'HR', 'SB', 'P_SO', 'P_H', 'P_R', 'P_HR', 'P_BB', 'LY Added', 'Added', 'LY Adj Wins', 'Adj Wins', 'Vegas', 'Proj wins', 'Diff']]
|
81 |
+
export_frame_team = export_frame_team.sort_values(by='Proj wins', ascending=False)
|
82 |
disp_frame = raw_frame[['Team', '2B', 'HR', 'SB', 'P_SO', 'P_H', 'P_R', 'P_HR', 'P_BB', 'LY Added', 'Added', 'LY Adj Wins', 'Adj Wins', 'Vegas', 'Proj wins', 'Diff']]
|
|
|
83 |
|
84 |
+
st.dataframe(disp_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), height = 1000, use_container_width = True)
|
85 |
|
86 |
st.download_button(
|
87 |
label="Export Team Win Projections",
|