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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
st.set_page_config(layout="wide")
|
| 3 |
+
|
| 4 |
+
for name in dir():
|
| 5 |
+
if not name.startswith('_'):
|
| 6 |
+
del globals()[name]
|
| 7 |
+
|
| 8 |
+
import numpy as np
|
| 9 |
+
import pandas as pd
|
| 10 |
+
import streamlit as st
|
| 11 |
+
import gspread
|
| 12 |
+
import gc
|
| 13 |
+
|
| 14 |
+
@st.cache_resource
|
| 15 |
+
def init_conn():
|
| 16 |
+
scope = ['https://spreadsheets.google.com/feeds', 'https://www.googleapis.com/auth/drive']
|
| 17 |
+
|
| 18 |
+
credentials = {
|
| 19 |
+
"type": "service_account",
|
| 20 |
+
"project_id": "model-sheets-connect",
|
| 21 |
+
"private_key_id": "0e0bc2fdef04e771172fe5807392b9d6639d945e",
|
| 22 |
+
"private_key": "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADANBgkqhkiG9w0BAQEFAASCBKgwggSkAgEAAoIBAQDiu1v/e6KBKOcK\ncx0KQ23nZK3ZVvADYy8u/RUn/EDI82QKxTd/DizRLIV81JiNQxDJXSzgkbwKYEDm\n48E8zGvupU8+Nk76xNPakrQKy2Y8+VJlq5psBtGchJTuUSHcXU5Mg2JhQsB376PJ\nsCw552K6Pw8fpeMDJDZuxpKSkaJR6k9G5Dhf5q8HDXnC5Rh/PRFuKJ2GGRpX7n+2\nhT/sCax0J8j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ZkvWThOgDd/ewt3ijMnJm5X05hOn\ni4XF1euTuvUl7wbqYx76Wv3/1ZojiNNgy7ie4rYlyB/6vlBS97F4ZxJdxMlabbCW\n6b3EMWa4EVVXKoA1sCY7IVDE+yoQ1JYsZmq45YzPAoGBANWWHuVueFGZRDZlkNlK\nh5OmySmA0NdNug3G1upaTthyaTZ+CxGliwBqMHAwpkIRPwxUJpUwBTSEGztGTAxs\nWsUOVWlD2/1JaKSmHE8JbNg6sxLilcG6WEDzxjC5dLL1OrGOXj9WhC9KX3sq6qb6\nF/j9eUXfXjAlb042MphoF3ZC\n-----END PRIVATE KEY-----\n",
|
| 23 |
+
"client_email": "gspread-connection@model-sheets-connect.iam.gserviceaccount.com",
|
| 24 |
+
"client_id": "100369174533302798535",
|
| 25 |
+
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
|
| 26 |
+
"token_uri": "https://oauth2.googleapis.com/token",
|
| 27 |
+
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
|
| 28 |
+
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/gspread-connection%40model-sheets-connect.iam.gserviceaccount.com"
|
| 29 |
+
}
|
| 30 |
+
|
| 31 |
+
gc_con = gspread.service_account_from_dict(credentials, scope)
|
| 32 |
+
|
| 33 |
+
return gc_con
|
| 34 |
+
|
| 35 |
+
gcservice_account = init_conn()
|
| 36 |
+
|
| 37 |
+
NBA_Data = 'https://docs.google.com/spreadsheets/d/1Yq0vGriWK-bS79e-bD6_u9pqrYE6Yrlbb_wEkmH-ot0/edit#gid=1808117109'
|
| 38 |
+
|
| 39 |
+
percentages_format = {'Pts% Boost': '{:.2%}', 'Reb% Boost': '{:.2%}', 'Ast% Boost': '{:.2%}', '3p% Boost': '{:.2%}',
|
| 40 |
+
'Stl Boost%': '{:.2%}', 'Blk Boost%': '{:.2%}', 'TOV Boost%': '{:.2%}', 'FPPM Boost': '{:.2%}',
|
| 41 |
+
'Team FPPM Boost': '{:.2%}'}
|
| 42 |
+
|
| 43 |
+
@st.cache_resource(ttl = 600)
|
| 44 |
+
def init_baselines():
|
| 45 |
+
sh = gcservice_account.open_by_url(NBA_Data)
|
| 46 |
+
|
| 47 |
+
worksheet = sh.worksheet('Trending')
|
| 48 |
+
raw_display = pd.DataFrame(worksheet.get_values())
|
| 49 |
+
raw_display.columns = raw_display.iloc[0]
|
| 50 |
+
raw_display = raw_display[1:]
|
| 51 |
+
raw_display = raw_display.reset_index(drop=True)
|
| 52 |
+
trend_table = raw_display[raw_display['PLAYER_NAME'] != ""]
|
| 53 |
+
trend_table = trend_table[['PLAYER_NAME', 'Team', 'Position', 'FD_Position', 'L10 MIN', 'L10 Fantasy', 'L10 Ceiling', 'L10 FD_Fantasy',
|
| 54 |
+
'L10 FD_Ceiling', 'L5 MIN', 'L5 Fantasy', 'L5 Ceiling', 'L5 FD_Fantasy', 'L5 FD_Ceiling', 'L3 MIN', 'L3 Fantasy',
|
| 55 |
+
'L3 Ceiling', 'L3 FD_Fantasy', 'L3 FD_Ceiling', 'Trend Min', 'Trend Median', 'DK_Proj', 'Adj Median', 'Adj Ceiling',
|
| 56 |
+
'Trend FD_Median', 'FD_Proj', 'Adj FD_Median', 'Adj FD_Ceiling', 'DK_Salary', 'DK_Avg_Val', 'DK_Ceiling_Value',
|
| 57 |
+
'FD_Salary', 'FD_Avg_Val', 'FD_Ceiling_Value']]
|
| 58 |
+
|
| 59 |
+
dk_minutes_table = trend_table[['PLAYER_NAME', 'Team', 'L10 MIN', 'L5 MIN', 'L3 MIN', 'Trend Min']]
|
| 60 |
+
|
| 61 |
+
fd_minutes_table = trend_table[['PLAYER_NAME', 'Team', 'L10 MIN', 'L5 MIN', 'L3 MIN', 'Trend Min']]
|
| 62 |
+
|
| 63 |
+
dk_medians_table = trend_table[['PLAYER_NAME', 'Team', 'L10 FANTASY', 'L5 FANTASY', 'L3 FANTASY', 'Trend Median']]
|
| 64 |
+
|
| 65 |
+
fd_medians_table = trend_table[['PLAYER_NAME', 'Team', 'L10 FD_FANTASY', 'L5 FD_FANTASY', 'L3 FD_FANTASY', 'Trend FD_Median']]
|
| 66 |
+
|
| 67 |
+
dk_proj_medians_table = trend_table[['PLAYER_NAME', 'Team', 'Position', 'DK_Salary', 'DK_Proj', 'Adj Median', 'DK_Avg_Val', 'Adj Ceiling', 'DK_Ceiling_Value']]
|
| 68 |
+
|
| 69 |
+
fd_proj_medians_table = trend_table[['PLAYER_NAME', 'Team', 'FD_Position', 'FD_Salary', 'FD_Proj', 'Adj FD_Median', 'FD_Avg_Val', 'Adj FD_Ceiling', 'FD_Ceiling_Value']]
|
| 70 |
+
|
| 71 |
+
return trend_table, dk_minutes_table, fd_minutes_table, dk_medians_table, fd_medians_table, dk_proj_medians_table, fd_proj_medians_table
|
| 72 |
+
|
| 73 |
+
def convert_df_to_csv(df):
|
| 74 |
+
return df.to_csv().encode('utf-8')
|
| 75 |
+
|
| 76 |
+
trend_table, dk_minutes_table, fd_minutes_table, dk_medians_table, fd_medians_table, dk_proj_medians_table, fd_proj_medians_table = init_baselines()
|
| 77 |
+
|
| 78 |
+
col1, col2 = st.columns([1, 9])
|
| 79 |
+
with col1:
|
| 80 |
+
if st.button("Reset Data", key='reset1'):
|
| 81 |
+
st.cache_data.clear()
|
| 82 |
+
trend_table, dk_minutes_table, fd_minutes_table, dk_medians_table, fd_medians_table, dk_proj_medians_table, fd_proj_medians_table = init_baselines()
|
| 83 |
+
split_var1 = st.radio("What table would you like to view?", ('Minutes Trends', 'Fantasy Trends', 'Slate specific', 'Overall'), key='split_var1')
|
| 84 |
+
site_var1 = st.radio("What site would you like to view?", ('Draftkings', 'Fanduel'), key='site_var1')
|
| 85 |
+
if site_var1 == 'Draftkings':
|
| 86 |
+
trend_table = trend_table[['PLAYER_NAME', 'Team', 'Position', 'L10 MIN', 'L10 Fantasy', 'L10 Ceiling',
|
| 87 |
+
'L5 MIN', 'L5 Fantasy', 'L5 Ceiling', 'L3 MIN', 'L3 Fantasy',
|
| 88 |
+
'L3 Ceiling', 'Trend Min', 'Trend Median', 'DK_Proj', 'Adj Median', 'Adj Ceiling',
|
| 89 |
+
'DK_Salary', 'DK_Avg_Val', 'DK_Ceiling_Value']]
|
| 90 |
+
minutes_table = dk_minutes_table
|
| 91 |
+
medians_table = dk_medians_table
|
| 92 |
+
proj_medians_table = dk_proj_medians_table
|
| 93 |
+
elif site_var1 == 'Fanduel':
|
| 94 |
+
trend_table = trend_table[['PLAYER_NAME', 'Team', 'FD_Position', 'L10 MIN', 'L10 FD_Fantasy',
|
| 95 |
+
'L10 FD_Ceiling', 'L5 MIN', 'L5 FD_Fantasy', 'L5 FD_Ceiling', 'L3 MIN', 'L3 FD_Fantasy',
|
| 96 |
+
'L3 FD_Ceiling', 'Trend Min', 'Trend FD_Median', 'FD_Proj', 'Adj FD_Median', 'Adj FD_Ceiling',
|
| 97 |
+
'FD_Salary', 'FD_Avg_Val', 'FD_Ceiling_Value']]
|
| 98 |
+
minutes_table = fd_minutes_table
|
| 99 |
+
medians_table = fd_medians_table
|
| 100 |
+
proj_medians_table = fd_proj_medians_table
|
| 101 |
+
trend_table = trend_table.set_axis(['PLAYER_NAME', 'Team', 'Position', 'L10 MIN', 'L10 Fantasy', 'L10 Ceiling',
|
| 102 |
+
'L5 MIN', 'L5 Fantasy', 'L5 Ceiling', 'L3 MIN', 'L3 Fantasy',
|
| 103 |
+
'L3 Ceiling', 'Trend Min', 'Trend Median', 'Proj', 'Adj Median', 'Adj Ceiling',
|
| 104 |
+
'Salary', 'Avg_Val', 'Ceiling_Value'], axis=1)
|
| 105 |
+
minutes_table = minutes_table.set_axis(['PLAYER_NAME', 'Team', 'L10 MIN', 'L5 MIN', 'L3 MIN', 'Trend Min'], axis=1)
|
| 106 |
+
medians_table = medians_table.set_axis(['PLAYER_NAME', 'Team', 'L10 FANTASY','L5 FANTASY', 'L3 FANTASY', 'Trend Median'], axis=1)
|
| 107 |
+
proj_medians_table = proj_medians_table.set_axis(['PLAYER_NAME', 'Team', 'Position', 'Salary', 'Proj',
|
| 108 |
+
'Adj Median', 'Avg_Val', 'Adj Ceiling', 'Ceiling_Value'], axis=1)
|
| 109 |
+
if split_var1 == 'Overall':
|
| 110 |
+
view_var1 = trend_table.Team.values.tolist()
|
| 111 |
+
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
| 112 |
+
|
| 113 |
+
if split_var2 == 'Specific Teams':
|
| 114 |
+
team_var1 = st.multiselect('Which teams would you like to include in the tables?', options = view_var1, key='team_var1')
|
| 115 |
+
elif split_var2 == 'All':
|
| 116 |
+
team_var1 = view_var1
|
| 117 |
+
|
| 118 |
+
split_var3 = st.radio("Would you like to view all positions or specific ones?", ('All', 'Specific Positions'), key='split_var3')
|
| 119 |
+
if split_var3 == 'Specific Positions':
|
| 120 |
+
pos_var1 = st.multiselect('Which positions would you like to include in the tables?', options = trend_table['Position'].unique(), key='pos_var1')
|
| 121 |
+
elif split_var3 == 'All':
|
| 122 |
+
pos_var1 = trend_table.Position.values.tolist()
|
| 123 |
+
|
| 124 |
+
proj_var1 = st.slider("Is there a certain projection range you want to view?", 0, 100, (10, 100), key='proj_var1')
|
| 125 |
+
|
| 126 |
+
elif split_var1 == 'Minutes Trends':
|
| 127 |
+
view_var2 = trend_table.Team.values.tolist()
|
| 128 |
+
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
| 129 |
+
|
| 130 |
+
if split_var2 == 'Specific Teams':
|
| 131 |
+
team_var1 = st.multiselect('Which teams would you like to include in the tables?', options = view_var1, key='team_var1')
|
| 132 |
+
elif split_var2 == 'All':
|
| 133 |
+
team_var1 = view_var1
|
| 134 |
+
|
| 135 |
+
elif split_var1 == 'Fantasy Trends':
|
| 136 |
+
view_var1 = trend_table.Team.values.tolist()
|
| 137 |
+
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
| 138 |
+
|
| 139 |
+
if split_var2 == 'Specific Teams':
|
| 140 |
+
team_var1 = st.multiselect('Which teams would you like to include in the tables?', options = view_var1, key='team_var1')
|
| 141 |
+
elif split_var2 == 'All':
|
| 142 |
+
team_var1 = view_var1
|
| 143 |
+
|
| 144 |
+
elif split_var1 == 'Slate Specific':
|
| 145 |
+
view_var1 = trend_table.Team.values.tolist()
|
| 146 |
+
split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
|
| 147 |
+
|
| 148 |
+
if split_var2 == 'Specific Teams':
|
| 149 |
+
team_var1 = st.multiselect('Which teams would you like to include in the tables?', options = view_var1, key='team_var1')
|
| 150 |
+
elif split_var2 == 'All':
|
| 151 |
+
team_var1 = view_var1
|
| 152 |
+
|
| 153 |
+
split_var3 = st.radio("Would you like to view all positions or specific ones?", ('All', 'Specific Positions'), key='split_var3')
|
| 154 |
+
if split_var3 == 'Specific Positions':
|
| 155 |
+
pos_var1 = st.multiselect('Which positions would you like to include in the tables?', options = proj_medians_table['Position'].unique(), key='pos_var1')
|
| 156 |
+
elif split_var3 == 'All':
|
| 157 |
+
pos_var1 = proj_medians_table.Position.values.tolist()
|
| 158 |
+
|
| 159 |
+
proj_var1 = st.slider("Is there a certain projection range you want to view?", 0, 100, (10, 100), key='proj_var1')
|
| 160 |
+
|
| 161 |
+
with col2:
|
| 162 |
+
if split_var1 == 'Overall':
|
| 163 |
+
table_display = trend_table[trend_table['Proj'] >= proj_var1[0]]
|
| 164 |
+
table_display = table_display[table_display['Proj'] <= proj_var1[1]]
|
| 165 |
+
table_display = table_display[table_display['Team'].isin(team_var1)]
|
| 166 |
+
table_display = table_display[table_display['Position'].isin(pos_var1)]
|
| 167 |
+
table_display = table_display.sort_values(by='Adj Ceiling', ascending=False)
|
| 168 |
+
table_display = table_display.set_index('PLAYER_NAME')
|
| 169 |
+
st.dataframe(table_display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
| 170 |
+
st.download_button(
|
| 171 |
+
label="Export Trending Numbers",
|
| 172 |
+
data=convert_df_to_csv(table_display),
|
| 173 |
+
file_name='Trending_export.csv',
|
| 174 |
+
mime='text/csv',
|
| 175 |
+
)
|
| 176 |
+
|
| 177 |
+
elif split_var1 == 'Minutes Trends':
|
| 178 |
+
table_display = minutes_table[minutes_table['Team'].isin(team_var1)]
|
| 179 |
+
table_display = table_display.set_index('PLAYER_NAME')
|
| 180 |
+
st.dataframe(table_display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
| 181 |
+
st.download_button(
|
| 182 |
+
label="Export Trending Numbers",
|
| 183 |
+
data=convert_df_to_csv(table_display),
|
| 184 |
+
file_name='Trending_export.csv',
|
| 185 |
+
mime='text/csv',
|
| 186 |
+
)
|
| 187 |
+
|
| 188 |
+
elif split_var1 == 'Fantasy Trends':
|
| 189 |
+
table_display = medians_table[medians_table['Team'].isin(team_var1)]
|
| 190 |
+
table_display = table_display.set_index('PLAYER_NAME')
|
| 191 |
+
st.dataframe(table_display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
| 192 |
+
st.download_button(
|
| 193 |
+
label="Export Trending Numbers",
|
| 194 |
+
data=convert_df_to_csv(table_display),
|
| 195 |
+
file_name='Trending_export.csv',
|
| 196 |
+
mime='text/csv',
|
| 197 |
+
)
|
| 198 |
+
|
| 199 |
+
elif split_var1 == 'Slate Specific':
|
| 200 |
+
table_display = proj_medians_table[proj_medians_table['Proj'] >= proj_var1[0]]
|
| 201 |
+
table_display = table_display[table_display['Proj'] <= proj_var1[1]]
|
| 202 |
+
table_display = table_display[table_display['Team'].isin(team_var1)]
|
| 203 |
+
table_display = table_display[table_display['Position'].isin(pos_var1)]
|
| 204 |
+
table_display = table_display.sort_values(by='Adj Ceiling', ascending=False)
|
| 205 |
+
table_display = table_display.set_index('PLAYER_NAME')
|
| 206 |
+
st.dataframe(table_display.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(percentages_format, precision=2), use_container_width = True)
|
| 207 |
+
st.download_button(
|
| 208 |
+
label="Export Trending Numbers",
|
| 209 |
+
data=convert_df_to_csv(table_display),
|
| 210 |
+
file_name='Trending_export.csv',
|
| 211 |
+
mime='text/csv',
|
| 212 |
+
)
|