James McCool commited on
Commit
0c21721
·
1 Parent(s): 2d3f164

Refactor logic to set 'Position' and 'Team' as 'FLEX' for specific sports in app.py, ensuring proper handling of player data when a CSV file is loaded.

Browse files
Files changed (1) hide show
  1. app.py +18 -19
app.py CHANGED
@@ -159,27 +159,26 @@ with tab1:
159
  st.session_state['csv_file']['Salary'] = st.session_state['csv_file']['Salary'].astype(str).str.replace(',', '').astype(int)
160
  except:
161
  pass
162
-
163
- if type_var == 'Showdown':
164
- st.session_state['csv_file']['Position'] = 'FLEX'
165
-
166
- if sport_var == 'GOLF':
167
- st.session_state['csv_file']['Position'] = 'FLEX'
168
- st.session_state['csv_file']['Team'] = 'GOLF'
169
- elif sport_var == 'TENNIS':
170
- st.session_state['csv_file']['Position'] = 'FLEX'
171
- st.session_state['csv_file']['Team'] = 'TENNIS'
172
- elif sport_var == 'MMA':
173
- st.session_state['csv_file']['Position'] = 'FLEX'
174
- st.session_state['csv_file']['Team'] = 'MMA'
175
- elif sport_var == 'NASCAR':
176
- st.session_state['csv_file']['Position'] = 'FLEX'
177
- st.session_state['csv_file']['Team'] = 'NASCAR'
178
- elif sport_var == 'F1':
179
- st.session_state['csv_file']['Position'] = 'FLEX'
180
- st.session_state['csv_file']['Team'] = 'F1'
181
 
182
  if csv_file:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
183
  # st.session_state['csv_file'] = st.session_state['csv_file'].drop_duplicates(subset=['Name'])
184
  st.success('Projections file loaded successfully!')
185
  st.dataframe(st.session_state['csv_file'].head(10))
 
159
  st.session_state['csv_file']['Salary'] = st.session_state['csv_file']['Salary'].astype(str).str.replace(',', '').astype(int)
160
  except:
161
  pass
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
162
 
163
  if csv_file:
164
+ if type_var == 'Showdown':
165
+ st.session_state['csv_file']['Position'] = 'FLEX'
166
+
167
+ if sport_var == 'GOLF':
168
+ st.session_state['csv_file']['Position'] = 'FLEX'
169
+ st.session_state['csv_file']['Team'] = 'GOLF'
170
+ elif sport_var == 'TENNIS':
171
+ st.session_state['csv_file']['Position'] = 'FLEX'
172
+ st.session_state['csv_file']['Team'] = 'TENNIS'
173
+ elif sport_var == 'MMA':
174
+ st.session_state['csv_file']['Position'] = 'FLEX'
175
+ st.session_state['csv_file']['Team'] = 'MMA'
176
+ elif sport_var == 'NASCAR':
177
+ st.session_state['csv_file']['Position'] = 'FLEX'
178
+ st.session_state['csv_file']['Team'] = 'NASCAR'
179
+ elif sport_var == 'F1':
180
+ st.session_state['csv_file']['Position'] = 'FLEX'
181
+ st.session_state['csv_file']['Team'] = 'F1'
182
  # st.session_state['csv_file'] = st.session_state['csv_file'].drop_duplicates(subset=['Name'])
183
  st.success('Projections file loaded successfully!')
184
  st.dataframe(st.session_state['csv_file'].head(10))