Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -63,17 +63,24 @@ def pull_baselines():
|
|
63 |
prop_trends['Player'].replace(['JJ Peterka', 'Alexander Killorn', 'Matt Boldy', 'Nick Paul', 'Alex Kerfoot'],
|
64 |
['John-Jason Peterka', 'Alex Killorn', 'Matthew Boldy', 'Nicholas Paul', 'Alexander Kerfoot'], inplace=True)
|
65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
66 |
team_dict = dict(zip(prop_table['Player'], prop_table['Team']))
|
67 |
|
68 |
worksheet = sh.worksheet('Timestamp')
|
69 |
timestamp = worksheet.acell('A1').value
|
70 |
|
71 |
-
return prop_table, prop_trends, timestamp, team_dict
|
72 |
|
73 |
def convert_df_to_csv(df):
|
74 |
return df.to_csv().encode('utf-8')
|
75 |
|
76 |
-
prop_display, prop_trends, timestamp, team_dict = pull_baselines()
|
77 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
78 |
|
79 |
tab1, tab2, tab3 = st.tabs(["Player Stat Table", 'Prop Trend Table', 'Stat Specific Simulations'])
|
@@ -82,7 +89,7 @@ with tab1:
|
|
82 |
st.info(t_stamp)
|
83 |
if st.button("Reset Data", key='reset1'):
|
84 |
st.cache_data.clear()
|
85 |
-
prop_display, prop_trends, timestamp, team_dict = pull_baselines()
|
86 |
prop_frame = prop_display
|
87 |
st.dataframe(prop_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
88 |
|
@@ -98,7 +105,7 @@ with tab2:
|
|
98 |
st.info(t_stamp)
|
99 |
if st.button("Reset Data", key='reset3'):
|
100 |
st.cache_data.clear()
|
101 |
-
prop_display, prop_trends, timestamp, team_dict = pull_baselines()
|
102 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
103 |
split_var5 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var5')
|
104 |
if split_var5 == 'Specific Teams':
|
@@ -123,7 +130,7 @@ with tab3:
|
|
123 |
st.info('The Over and Under percentages are a composite percentage based on simulations, historical performance, and implied probabilities, and may be different than you would expect based purely on the median projection. Likewise, the Edge of a bet is not the only indicator of if you should make the bet or not as the suggestion is using a base acceptable threshold to determine how much edge you should have for each stat category.')
|
124 |
if st.button("Reset Data/Load Data", key='reset5'):
|
125 |
st.cache_data.clear()
|
126 |
-
prop_display, prop_trends, timestamp, team_dict = pull_baselines()
|
127 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
128 |
col1, col2 = st.columns([1, 5])
|
129 |
|
@@ -134,6 +141,19 @@ with tab3:
|
|
134 |
export_container = st.empty()
|
135 |
|
136 |
with col1:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
137 |
prop_type_var = st.selectbox('Select prop category', options = ['All Props', 'SOG', 'points', 'blocked_shots', 'assists'])
|
138 |
if prop_type_var == 'All Props':
|
139 |
st.info('please note that the All Props run can take some time, you will see progress as tables show up in the sim area to the right')
|
|
|
63 |
prop_trends['Player'].replace(['JJ Peterka', 'Alexander Killorn', 'Matt Boldy', 'Nick Paul', 'Alex Kerfoot'],
|
64 |
['John-Jason Peterka', 'Alex Killorn', 'Matthew Boldy', 'Nicholas Paul', 'Alexander Kerfoot'], inplace=True)
|
65 |
|
66 |
+
worksheet = sh.worksheet('Pick6_ingest')
|
67 |
+
raw_display = pd.DataFrame(worksheet.get_all_records())
|
68 |
+
raw_display.replace('', np.nan, inplace=True)
|
69 |
+
pick_frame = raw_display.dropna(subset='Player')
|
70 |
+
pick_frame['Player'].replace(['JJ Peterka', 'Alexander Killorn', 'Matt Boldy', 'Nick Paul', 'Alex Kerfoot'],
|
71 |
+
['John-Jason Peterka', 'Alex Killorn', 'Matthew Boldy', 'Nicholas Paul', 'Alexander Kerfoot'], inplace=True)
|
72 |
+
|
73 |
team_dict = dict(zip(prop_table['Player'], prop_table['Team']))
|
74 |
|
75 |
worksheet = sh.worksheet('Timestamp')
|
76 |
timestamp = worksheet.acell('A1').value
|
77 |
|
78 |
+
return prop_table, prop_trends, pick_frame, timestamp, team_dict
|
79 |
|
80 |
def convert_df_to_csv(df):
|
81 |
return df.to_csv().encode('utf-8')
|
82 |
|
83 |
+
prop_display, prop_trends, pick_frame, timestamp, team_dict = pull_baselines()
|
84 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
85 |
|
86 |
tab1, tab2, tab3 = st.tabs(["Player Stat Table", 'Prop Trend Table', 'Stat Specific Simulations'])
|
|
|
89 |
st.info(t_stamp)
|
90 |
if st.button("Reset Data", key='reset1'):
|
91 |
st.cache_data.clear()
|
92 |
+
prop_display, prop_trends, pick_frame, timestamp, team_dict = pull_baselines()
|
93 |
prop_frame = prop_display
|
94 |
st.dataframe(prop_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
|
95 |
|
|
|
105 |
st.info(t_stamp)
|
106 |
if st.button("Reset Data", key='reset3'):
|
107 |
st.cache_data.clear()
|
108 |
+
prop_display, prop_trends, pick_frame, timestamp, team_dict = pull_baselines()
|
109 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
110 |
split_var5 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var5')
|
111 |
if split_var5 == 'Specific Teams':
|
|
|
130 |
st.info('The Over and Under percentages are a composite percentage based on simulations, historical performance, and implied probabilities, and may be different than you would expect based purely on the median projection. Likewise, the Edge of a bet is not the only indicator of if you should make the bet or not as the suggestion is using a base acceptable threshold to determine how much edge you should have for each stat category.')
|
131 |
if st.button("Reset Data/Load Data", key='reset5'):
|
132 |
st.cache_data.clear()
|
133 |
+
prop_display, prop_trends, pick_frame, timestamp, team_dict = pull_baselines()
|
134 |
t_stamp = f"Last Update: " + str(timestamp) + f" CST"
|
135 |
col1, col2 = st.columns([1, 5])
|
136 |
|
|
|
141 |
export_container = st.empty()
|
142 |
|
143 |
with col1:
|
144 |
+
game_select_var = st.selectbox('Select prop source', options = ['Draftkings', 'Pick6'])
|
145 |
+
if game_select_var == 'Draftkings':
|
146 |
+
prop_df = prop_trends[['Player', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
147 |
+
elif game_select_var == 'Pick6':
|
148 |
+
prop_df = pick_frame[['Full_name', 'over_prop', 'over_line', 'under_line', 'prop_type']]
|
149 |
+
prop_df.rename(columns={"Full_name": "Player"}, inplace = True)
|
150 |
+
st.download_button(
|
151 |
+
label="Download Prop Source",
|
152 |
+
data=convert_df_to_csv(prop_df),
|
153 |
+
file_name='Nba_prop_source.csv',
|
154 |
+
mime='text/csv',
|
155 |
+
key='prop_source',
|
156 |
+
)
|
157 |
prop_type_var = st.selectbox('Select prop category', options = ['All Props', 'SOG', 'points', 'blocked_shots', 'assists'])
|
158 |
if prop_type_var == 'All Props':
|
159 |
st.info('please note that the All Props run can take some time, you will see progress as tables show up in the sim area to the right')
|