Multichem commited on
Commit
9912dc6
·
verified ·
1 Parent(s): 7ec6c72

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -108
app.py CHANGED
@@ -1,17 +1,6 @@
1
- import pulp
2
  import numpy as np
3
  import pandas as pd
4
- import random
5
- import sys
6
- import openpyxl
7
- import re
8
- import time
9
  import streamlit as st
10
- import matplotlib
11
- from matplotlib.colors import LinearSegmentedColormap
12
- from st_aggrid import GridOptionsBuilder, AgGrid, GridUpdateMode, DataReturnMode
13
- import json
14
- import requests
15
  import gspread
16
  import plotly.figure_factory as ff
17
 
@@ -41,91 +30,42 @@ american_format = {'First Inning Lead Percentage': '{:.2%}', 'Fifth Inning Lead
41
 
42
  master_hold = 'https://docs.google.com/spreadsheets/d/1f42Ergav8K1VsOLOK9MUn7DM_MLMvv4GR2Fy7EfnZTc/edit#gid=340831852'
43
 
44
- @st.cache_data
45
- def load_pitcher_props():
46
  sh = gc.open_by_url(master_hold)
47
  worksheet = sh.worksheet('Pitcher_Stats')
48
  props_frame_hold = pd.DataFrame(worksheet.get_all_records())
49
  props_frame_hold.rename(columns={"Names": "Player"}, inplace = True)
50
  props_frame_hold = props_frame_hold[['Player', 'Team', 'BB', 'Hits', 'HRs', 'ERs', 'Ks', 'Outs', 'Fantasy', 'FD_Fantasy', 'PrizePicks']]
51
- props_frame_hold = props_frame_hold.drop_duplicates(subset='Player')
52
 
53
- return props_frame_hold
54
-
55
- @st.cache_data
56
- def load_time():
57
- sh = gc.open_by_url(master_hold)
58
  worksheet = sh.worksheet('Timestamp')
59
  raw_stamp = worksheet.acell('a1').value
60
 
61
  t_stamp = f"Last update was at {raw_stamp}"
62
 
63
- return t_stamp
64
-
65
- @st.cache_data
66
- def load_hitter_props():
67
- sh = gc.open_by_url(master_hold)
68
  worksheet = sh.worksheet('Hitter_Stats')
69
  props_frame_hold = pd.DataFrame(worksheet.get_all_records())
70
  props_frame_hold.rename(columns={"Names": "Player"}, inplace = True)
71
  props_frame_hold = props_frame_hold[['Player', 'Team', 'Walks', 'Steals', 'Hits', 'Singles', 'Doubles', 'HRs', 'RBIs', 'Runs', 'Fantasy', 'FD_Fantasy', 'PrizePicks']]
72
  props_frame_hold['Total Bases'] = props_frame_hold['Singles'] + (props_frame_hold['Doubles'] * 2) + (props_frame_hold['HRs'] * 4)
73
  props_frame_hold['Hits + Runs + RBIs'] = props_frame_hold['Hits'] + props_frame_hold['Runs'] + props_frame_hold['RBIs']
74
- props_frame_hold = props_frame_hold.drop_duplicates(subset='Player')
75
 
76
- return props_frame_hold
77
-
78
- @st.cache_data
79
- def load_team_table():
80
- sh = gc.open_by_url(master_hold)
81
  worksheet = sh.worksheet('Game_Betting_Model')
82
  team_frame = pd.DataFrame(worksheet.get_all_records())
83
  team_frame = team_frame.drop_duplicates(subset='Names')
84
  team_frame['Win Percentage'] = team_frame['Win Percentage'].str.replace('%', '').astype('float')/100
85
  team_frame['Cover Spread Percentage'] = team_frame['Cover Spread Percentage'].str.replace('%', '').astype('float')/100
86
 
87
- return team_frame
88
-
89
- @st.cache_data
90
- def load_strikeout_props():
91
- sh = gc.open_by_url(master_hold)
92
- worksheet = sh.worksheet('Strikeout_Props')
93
- prop_type_frame = pd.DataFrame(worksheet.get_all_records())
94
- prop_type_frame = prop_type_frame.drop_duplicates(subset='Player')
95
-
96
- return prop_type_frame
97
-
98
- @st.cache_data
99
- def load_total_outs_props():
100
- sh = gc.open_by_url(master_hold)
101
- worksheet = sh.worksheet('Total_Outs_Props')
102
- prop_type_frame = pd.DataFrame(worksheet.get_all_records())
103
- prop_type_frame = prop_type_frame.drop_duplicates(subset='Player')
104
-
105
- return prop_type_frame
106
-
107
- @st.cache_data
108
- def load_total_bases_props():
109
- sh = gc.open_by_url(master_hold)
110
- worksheet = sh.worksheet('Total_Base_Props')
111
- prop_type_frame = pd.DataFrame(worksheet.get_all_records())
112
- prop_type_frame = prop_type_frame.drop_duplicates(subset='Player')
113
-
114
- return prop_type_frame
115
-
116
- @st.cache_data
117
- def load_stolen_bases_props():
118
- sh = gc.open_by_url(master_hold)
119
- worksheet = sh.worksheet('SB_Props')
120
- prop_type_frame = pd.DataFrame(worksheet.get_all_records())
121
- prop_type_frame = prop_type_frame.drop_duplicates(subset='Player')
122
 
123
- return prop_type_frame
124
 
125
- pitcher_frame_hold = load_pitcher_props()
126
- hitter_frame_hold = load_hitter_props()
127
- team_frame_hold = load_team_table()
128
- t_stamp = load_time()
129
 
130
  tab1, tab2, tab3, tab4, tab5 = st.tabs(["Game Betting Model", "Pitcher Prop Projections", "Hitter Prop Projections", "Player Prop Simulations", "Stat Specific Simulations"])
131
 
@@ -136,12 +76,8 @@ with tab1:
136
  st.info(t_stamp)
137
  if st.button("Reset Data", key='reset1'):
138
  st.cache_data.clear()
139
- pitcher_frame_hold = load_pitcher_props()
140
- hitter_frame_hold = load_hitter_props()
141
- team_frame_hold = load_team_table()
142
- t_stamp = load_time()
143
  line_var1 = st.radio('How would you like to display odds?', options = ['Percentage', 'American'], key='line_var1')
144
- team_frame = team_frame_hold
145
  if line_var1 == 'Percentage':
146
  team_frame = team_frame[['Names', 'Game', 'Win Percentage', 'Spread', 'Cover Spread Percentage', 'Avg Score', 'Game Total', 'Avg Fifth Inning', 'Fifth Inning Lead Percentage']]
147
  team_frame = team_frame.set_index('Names')
@@ -164,17 +100,14 @@ with tab2:
164
  st.info(t_stamp)
165
  if st.button("Reset Data", key='reset2'):
166
  st.cache_data.clear()
167
- pitcher_frame_hold = load_pitcher_props()
168
- hitter_frame_hold = load_hitter_props()
169
- team_frame_hold = load_team_table()
170
- t_stamp = load_time()
171
  split_var1 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var1')
172
  if split_var1 == 'Specific Teams':
173
- team_var1 = st.multiselect('Which teams would you like to include in the tables?', options = pitcher_frame_hold['Team'].unique(), key='team_var1')
174
  elif split_var1 == 'All':
175
- team_var1 = pitcher_frame_hold.Team.values.tolist()
176
- pitcher_frame_hold = pitcher_frame_hold[pitcher_frame_hold['Team'].isin(team_var1)]
177
- pitcher_frame = pitcher_frame_hold.set_index('Player')
178
  pitcher_frame = pitcher_frame.sort_values(by='Ks', ascending=False)
179
  st.dataframe(pitcher_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
180
  st.download_button(
@@ -189,17 +122,14 @@ with tab3:
189
  st.info(t_stamp)
190
  if st.button("Reset Data", key='reset3'):
191
  st.cache_data.clear()
192
- pitcher_frame_hold = load_pitcher_props()
193
- hitter_frame_hold = load_hitter_props()
194
- team_frame_hold = load_team_table()
195
- t_stamp = load_time()
196
  split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
197
  if split_var2 == 'Specific Teams':
198
- team_var2 = st.multiselect('Which teams would you like to include in the tables?', options = hitter_frame_hold['Team'].unique(), key='team_var2')
199
  elif split_var2 == 'All':
200
- team_var2 = hitter_frame_hold.Team.values.tolist()
201
- hitter_frame_hold = hitter_frame_hold[hitter_frame_hold['Team'].isin(team_var2)]
202
- hitter_frame = hitter_frame_hold.set_index('Player')
203
  hitter_frame = hitter_frame.sort_values(by='Hits + Runs + RBIs', ascending=False)
204
  st.dataframe(hitter_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
205
  st.download_button(
@@ -214,10 +144,7 @@ with tab4:
214
  st.info(t_stamp)
215
  if st.button("Reset Data", key='reset4'):
216
  st.cache_data.clear()
217
- pitcher_frame_hold = load_pitcher_props()
218
- hitter_frame_hold = load_hitter_props()
219
- team_frame_hold = load_team_table()
220
- t_stamp = load_time()
221
  col1, col2 = st.columns([1, 5])
222
 
223
  with col2:
@@ -228,10 +155,10 @@ with tab4:
228
  with col1:
229
  prop_group_var = st.selectbox('What kind of props are you simulating?', options = ['Pitchers', 'Hitters'])
230
  if prop_group_var == 'Pitchers':
231
- player_check = st.selectbox('Select player to simulate props', options = pitcher_frame_hold['Player'].unique())
232
  prop_type_var = st.selectbox('Select type of prop to simulate', options = ['Strikeouts', 'Walks', 'Hits', 'Homeruns', 'Earned Runs', 'Outs', 'Fantasy', 'FD_Fantasy', 'PrizePicks'])
233
  elif prop_group_var == 'Hitters':
234
- player_check = st.selectbox('Select player to simulate props', options = hitter_frame_hold['Player'].unique())
235
  prop_type_var = st.selectbox('Select type of prop to simulate', options = ['Total Bases', 'Walks', 'Steals', 'Hits', 'Singles', 'Doubles', 'Homeruns', 'RBIs', 'Runs', 'Hits + Runs + RBIs', 'Fantasy', 'FD_Fantasy', 'PrizePicks'])
236
 
237
  ou_var = st.selectbox('Select wether it is an over or under', options = ['Over', 'Under'])
@@ -245,9 +172,9 @@ with tab4:
245
  with df_hold_container.container():
246
 
247
  if prop_group_var == 'Pitchers':
248
- df = pitcher_frame_hold
249
  elif prop_group_var == 'Hitters':
250
- df = hitter_frame_hold
251
 
252
  total_sims = 1000
253
 
@@ -384,7 +311,7 @@ with tab5:
384
  # Clear values from *all* all in-memory and on-disk data caches:
385
  # i.e. clear values from both square and cube
386
  st.cache_data.clear()
387
- t_stamp = load_time()
388
  col1, col2 = st.columns([1, 5])
389
 
390
  with col2:
@@ -402,8 +329,8 @@ with tab5:
402
  with df_hold_container.container():
403
 
404
  if prop_type_var == "Strikeouts (Pitchers)":
405
- player_df = pitcher_frame_hold
406
- prop_df = load_strikeout_props()
407
  prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
408
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
409
  prop_df = prop_df.loc[prop_df['Prop'] != 0]
@@ -411,8 +338,8 @@ with tab5:
411
  prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+100)), 100/(prop_df['under_line']+100))
412
  df = pd.merge(player_df, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
413
  elif prop_type_var == "Total Outs (Pitchers)":
414
- player_df = pitcher_frame_hold
415
- prop_df = load_total_outs_props()
416
  prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
417
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
418
  prop_df = prop_df.loc[prop_df['Prop'] != 0]
@@ -420,8 +347,8 @@ with tab5:
420
  prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+100)), 100/(prop_df['under_line']+100))
421
  df = pd.merge(player_df, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
422
  elif prop_type_var == "Total Bases (Hitters)":
423
- player_df = hitter_frame_hold
424
- prop_df = load_total_bases_props()
425
  prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
426
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
427
  prop_df = prop_df.loc[prop_df['Prop'] != 0]
@@ -429,8 +356,8 @@ with tab5:
429
  prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+100)), 100/(prop_df['under_line']+100))
430
  df = pd.merge(player_df, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
431
  elif prop_type_var == "Stolen Bases (Hitters)":
432
- player_df = hitter_frame_hold
433
- prop_df = load_stolen_base_props()
434
  prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
435
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
436
  prop_df = prop_df.loc[prop_df['Prop'] != 0]
 
 
1
  import numpy as np
2
  import pandas as pd
 
 
 
 
 
3
  import streamlit as st
 
 
 
 
 
4
  import gspread
5
  import plotly.figure_factory as ff
6
 
 
30
 
31
  master_hold = 'https://docs.google.com/spreadsheets/d/1f42Ergav8K1VsOLOK9MUn7DM_MLMvv4GR2Fy7EfnZTc/edit#gid=340831852'
32
 
33
+ @st.cache_resource(ttl = 299)
34
+ def init_baselines():
35
  sh = gc.open_by_url(master_hold)
36
  worksheet = sh.worksheet('Pitcher_Stats')
37
  props_frame_hold = pd.DataFrame(worksheet.get_all_records())
38
  props_frame_hold.rename(columns={"Names": "Player"}, inplace = True)
39
  props_frame_hold = props_frame_hold[['Player', 'Team', 'BB', 'Hits', 'HRs', 'ERs', 'Ks', 'Outs', 'Fantasy', 'FD_Fantasy', 'PrizePicks']]
40
+ pitcher_stats = props_frame_hold.drop_duplicates(subset='Player')
41
 
 
 
 
 
 
42
  worksheet = sh.worksheet('Timestamp')
43
  raw_stamp = worksheet.acell('a1').value
44
 
45
  t_stamp = f"Last update was at {raw_stamp}"
46
 
 
 
 
 
 
47
  worksheet = sh.worksheet('Hitter_Stats')
48
  props_frame_hold = pd.DataFrame(worksheet.get_all_records())
49
  props_frame_hold.rename(columns={"Names": "Player"}, inplace = True)
50
  props_frame_hold = props_frame_hold[['Player', 'Team', 'Walks', 'Steals', 'Hits', 'Singles', 'Doubles', 'HRs', 'RBIs', 'Runs', 'Fantasy', 'FD_Fantasy', 'PrizePicks']]
51
  props_frame_hold['Total Bases'] = props_frame_hold['Singles'] + (props_frame_hold['Doubles'] * 2) + (props_frame_hold['HRs'] * 4)
52
  props_frame_hold['Hits + Runs + RBIs'] = props_frame_hold['Hits'] + props_frame_hold['Runs'] + props_frame_hold['RBIs']
53
+ hitter_stats = props_frame_hold.drop_duplicates(subset='Player')
54
 
 
 
 
 
 
55
  worksheet = sh.worksheet('Game_Betting_Model')
56
  team_frame = pd.DataFrame(worksheet.get_all_records())
57
  team_frame = team_frame.drop_duplicates(subset='Names')
58
  team_frame['Win Percentage'] = team_frame['Win Percentage'].str.replace('%', '').astype('float')/100
59
  team_frame['Cover Spread Percentage'] = team_frame['Cover Spread Percentage'].str.replace('%', '').astype('float')/100
60
 
61
+ worksheet = sh.worksheet('prop_frame')
62
+ raw_display = pd.DataFrame(worksheet.get_all_records())
63
+ raw_display.replace('', np.nan, inplace=True)
64
+ prop_frame = raw_display.dropna(subset='Team')
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
65
 
66
+ return pitcher_stats, hitter_stats, team_frame, prop_frame, t_stamp
67
 
68
+ pitcher_stats, hitter_stats, team_frame, prop_frame, t_stamp = init_baselines()
 
 
 
69
 
70
  tab1, tab2, tab3, tab4, tab5 = st.tabs(["Game Betting Model", "Pitcher Prop Projections", "Hitter Prop Projections", "Player Prop Simulations", "Stat Specific Simulations"])
71
 
 
76
  st.info(t_stamp)
77
  if st.button("Reset Data", key='reset1'):
78
  st.cache_data.clear()
79
+ pitcher_stats, hitter_stats, team_frame, prop_frame, t_stamp = init_baselines()
 
 
 
80
  line_var1 = st.radio('How would you like to display odds?', options = ['Percentage', 'American'], key='line_var1')
 
81
  if line_var1 == 'Percentage':
82
  team_frame = team_frame[['Names', 'Game', 'Win Percentage', 'Spread', 'Cover Spread Percentage', 'Avg Score', 'Game Total', 'Avg Fifth Inning', 'Fifth Inning Lead Percentage']]
83
  team_frame = team_frame.set_index('Names')
 
100
  st.info(t_stamp)
101
  if st.button("Reset Data", key='reset2'):
102
  st.cache_data.clear()
103
+ pitcher_stats, hitter_stats, team_frame, prop_frame, t_stamp = init_baselines()
 
 
 
104
  split_var1 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var1')
105
  if split_var1 == 'Specific Teams':
106
+ team_var1 = st.multiselect('Which teams would you like to include in the tables?', options = pitcher_stats['Team'].unique(), key='team_var1')
107
  elif split_var1 == 'All':
108
+ team_var1 = pitcher_stats.Team.values.tolist()
109
+ pitcher_stats = pitcher_stats[pitcher_stats['Team'].isin(team_var1)]
110
+ pitcher_frame = pitcher_stats.set_index('Player')
111
  pitcher_frame = pitcher_frame.sort_values(by='Ks', ascending=False)
112
  st.dataframe(pitcher_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
113
  st.download_button(
 
122
  st.info(t_stamp)
123
  if st.button("Reset Data", key='reset3'):
124
  st.cache_data.clear()
125
+ pitcher_stats, hitter_stats, team_frame, prop_frame, t_stamp = init_baselines()
 
 
 
126
  split_var2 = st.radio("Would you like to view all teams or specific ones?", ('All', 'Specific Teams'), key='split_var2')
127
  if split_var2 == 'Specific Teams':
128
+ team_var2 = st.multiselect('Which teams would you like to include in the tables?', options = hitter_stats['Team'].unique(), key='team_var2')
129
  elif split_var2 == 'All':
130
+ team_var2 = hitter_stats.Team.values.tolist()
131
+ hitter_stats = hitter_stats[hitter_stats['Team'].isin(team_var2)]
132
+ hitter_frame = hitter_stats.set_index('Player')
133
  hitter_frame = hitter_frame.sort_values(by='Hits + Runs + RBIs', ascending=False)
134
  st.dataframe(hitter_frame.style.background_gradient(axis=0).background_gradient(cmap='RdYlGn').format(precision=2), use_container_width = True)
135
  st.download_button(
 
144
  st.info(t_stamp)
145
  if st.button("Reset Data", key='reset4'):
146
  st.cache_data.clear()
147
+ pitcher_stats, hitter_stats, team_frame, prop_frame, t_stamp = init_baselines()
 
 
 
148
  col1, col2 = st.columns([1, 5])
149
 
150
  with col2:
 
155
  with col1:
156
  prop_group_var = st.selectbox('What kind of props are you simulating?', options = ['Pitchers', 'Hitters'])
157
  if prop_group_var == 'Pitchers':
158
+ player_check = st.selectbox('Select player to simulate props', options = pitcher_stats['Player'].unique())
159
  prop_type_var = st.selectbox('Select type of prop to simulate', options = ['Strikeouts', 'Walks', 'Hits', 'Homeruns', 'Earned Runs', 'Outs', 'Fantasy', 'FD_Fantasy', 'PrizePicks'])
160
  elif prop_group_var == 'Hitters':
161
+ player_check = st.selectbox('Select player to simulate props', options = hitter_stats['Player'].unique())
162
  prop_type_var = st.selectbox('Select type of prop to simulate', options = ['Total Bases', 'Walks', 'Steals', 'Hits', 'Singles', 'Doubles', 'Homeruns', 'RBIs', 'Runs', 'Hits + Runs + RBIs', 'Fantasy', 'FD_Fantasy', 'PrizePicks'])
163
 
164
  ou_var = st.selectbox('Select wether it is an over or under', options = ['Over', 'Under'])
 
172
  with df_hold_container.container():
173
 
174
  if prop_group_var == 'Pitchers':
175
+ df = pitcher_stats
176
  elif prop_group_var == 'Hitters':
177
+ df = hitter_stats
178
 
179
  total_sims = 1000
180
 
 
311
  # Clear values from *all* all in-memory and on-disk data caches:
312
  # i.e. clear values from both square and cube
313
  st.cache_data.clear()
314
+ pitcher_stats, hitter_stats, team_frame, prop_frame, t_stamp = init_baselines()
315
  col1, col2 = st.columns([1, 5])
316
 
317
  with col2:
 
329
  with df_hold_container.container():
330
 
331
  if prop_type_var == "Strikeouts (Pitchers)":
332
+ player_df = pitcher_stats
333
+ prop_df = pitcher_stats[pitcher_stats['prop_type'] == 'pitcher_strikeouts']
334
  prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
335
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
336
  prop_df = prop_df.loc[prop_df['Prop'] != 0]
 
338
  prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+100)), 100/(prop_df['under_line']+100))
339
  df = pd.merge(player_df, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
340
  elif prop_type_var == "Total Outs (Pitchers)":
341
+ player_df = pitcher_stats
342
+ prop_df = pitcher_stats[pitcher_stats['prop_type'] == 'pitcher_strikeouts']
343
  prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
344
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
345
  prop_df = prop_df.loc[prop_df['Prop'] != 0]
 
347
  prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+100)), 100/(prop_df['under_line']+100))
348
  df = pd.merge(player_df, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
349
  elif prop_type_var == "Total Bases (Hitters)":
350
+ player_df = hitter_stats
351
+ prop_df = hitter_stats[hitter_stats['prop_type'] == 'batter_total_bases']
352
  prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
353
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
354
  prop_df = prop_df.loc[prop_df['Prop'] != 0]
 
356
  prop_df['Under'] = np.where(prop_df['under_line'] < 0, (-(prop_df['under_line'])/((-(prop_df['under_line']))+100)), 100/(prop_df['under_line']+100))
357
  df = pd.merge(player_df, prop_df, how='left', left_on=['Player'], right_on = ['Player'])
358
  elif prop_type_var == "Stolen Bases (Hitters)":
359
+ player_df = hitter_stats
360
+ prop_df = hitter_stats[hitter_stats['prop_type'] == 'batter_stolen_bases']
361
  prop_df = prop_df[['Player', 'over_prop', 'over_line', 'under_line']]
362
  prop_df.rename(columns={"over_prop": "Prop"}, inplace = True)
363
  prop_df = prop_df.loc[prop_df['Prop'] != 0]