James McCool commited on
Commit
b9049ff
·
1 Parent(s): 7f0bbb5

Enhance app.py to include F1 in sport selection and implement position and team variable assignments based on selected sport. Update projections to reflect these variables for GOLF, TENNIS, MMA, NASCAR, and F1, improving data handling for player eligibility.

Browse files
Files changed (2) hide show
  1. app.py +26 -1
  2. global_func/exposure_spread.py +6 -0
app.py CHANGED
@@ -42,11 +42,30 @@ with st.container():
42
  site_var = st.selectbox("Select Site", ['Draftkings', 'Fanduel'])
43
 
44
  with col3:
45
- sport_var = st.selectbox("Select Sport", ['NFL', 'MLB', 'NBA', 'NHL', 'MMA', 'CS2', 'LOL', 'TENNIS', 'NASCAR', 'GOLF', 'WNBA'])
46
 
47
  with col4:
48
  type_var = st.selectbox("Select Game Type", ['Classic', 'Showdown'])
49
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
  if site_var == 'Draftkings':
51
  salary_max = 50000
52
  elif site_var == 'Fanduel':
@@ -203,6 +222,12 @@ with tab1:
203
  projections = projections.drop(columns='CPT_Own_raw', axis=1)
204
 
205
  projections = projections.apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
 
 
 
 
 
 
206
  st.dataframe(projections.head(10))
207
 
208
  if portfolio_file and projections_file:
 
42
  site_var = st.selectbox("Select Site", ['Draftkings', 'Fanduel'])
43
 
44
  with col3:
45
+ sport_var = st.selectbox("Select Sport", ['NFL', 'MLB', 'NBA', 'NHL', 'MMA', 'CS2', 'LOL', 'TENNIS', 'NASCAR', 'GOLF', 'WNBA', 'F1'])
46
 
47
  with col4:
48
  type_var = st.selectbox("Select Game Type", ['Classic', 'Showdown'])
49
 
50
+ if sport_var == 'GOLF':
51
+ position_var = 'G'
52
+ team_var = 'GOLF'
53
+ elif sport_var == 'TENNIS':
54
+ position_var = 'T'
55
+ team_var = 'TENNIS'
56
+ elif sport_var == 'MMA':
57
+ position_var = 'F'
58
+ team_var = 'MMA'
59
+ elif sport_var == 'NASCAR':
60
+ position_var = 'D'
61
+ team_var = 'NASCAR'
62
+ elif sport_var == 'F1':
63
+ position_var = 'D'
64
+ team_var = 'F1'
65
+ else:
66
+ position_var = None
67
+ team_var = None
68
+
69
  if site_var == 'Draftkings':
70
  salary_max = 50000
71
  elif site_var == 'Fanduel':
 
222
  projections = projections.drop(columns='CPT_Own_raw', axis=1)
223
 
224
  projections = projections.apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
225
+ ### if the position column is empty, set to sport_var appropriate position
226
+ if position_var is not None:
227
+ projections['position'] = position_var
228
+ if team_var is not None:
229
+ projections['team'] = team_var
230
+
231
  st.dataframe(projections.head(10))
232
 
233
  if portfolio_file and projections_file:
global_func/exposure_spread.py CHANGED
@@ -113,6 +113,8 @@ def check_tennis_position_eligibility(column_name, player_positions):
113
  Returns:
114
  bool: True if player is eligible for the column
115
  """
 
 
116
  return True
117
 
118
  def check_mma_position_eligibility(column_name, player_positions):
@@ -126,6 +128,8 @@ def check_mma_position_eligibility(column_name, player_positions):
126
  Returns:
127
  bool: True if player is eligible for the column
128
  """
 
 
129
  return True
130
 
131
  def check_nascar_position_eligibility(column_name, player_positions):
@@ -139,6 +143,8 @@ def check_nascar_position_eligibility(column_name, player_positions):
139
  Returns:
140
  bool: True if player is eligible for the column
141
  """
 
 
142
  return True
143
 
144
  def check_cfb_position_eligibility(column_name, player_positions):
 
113
  Returns:
114
  bool: True if player is eligible for the column
115
  """
116
+ if 'FLEX' in column_name:
117
+ return any(pos in ['T'] for pos in player_positions)
118
  return True
119
 
120
  def check_mma_position_eligibility(column_name, player_positions):
 
128
  Returns:
129
  bool: True if player is eligible for the column
130
  """
131
+ if 'FLEX' in column_name:
132
+ return any(pos in ['F'] for pos in player_positions)
133
  return True
134
 
135
  def check_nascar_position_eligibility(column_name, player_positions):
 
143
  Returns:
144
  bool: True if player is eligible for the column
145
  """
146
+ if 'FLEX' in column_name:
147
+ return any(pos in ['D'] for pos in player_positions)
148
  return True
149
 
150
  def check_cfb_position_eligibility(column_name, player_positions):