James McCool
commited on
Commit
·
2d3f164
1
Parent(s):
cf0e214
Implement logic to set 'Position' and 'Team' as 'FLEX' for specific sports in app.py, enhancing player data handling for GOLF, TENNIS, MMA, NASCAR, and F1.
Browse files
app.py
CHANGED
@@ -33,10 +33,6 @@ player_wrong_names_mlb = ['Enrique Hernandez', 'Joseph Cantillo', 'Mike Soroka',
|
|
33 |
player_right_names_mlb = ['Kike Hernandez', 'Joey Cantillo', 'Michael Soroka', 'Jake Bauers', 'Temi Fagbenle']
|
34 |
|
35 |
def create_position_export_dict(column_name, csv_file):
|
36 |
-
"""
|
37 |
-
Create a position-specific export dictionary based on the column name.
|
38 |
-
Strips numbers from column names to get the position (e.g., 'SP1' -> 'SP', 'G2' -> 'G')
|
39 |
-
"""
|
40 |
try:
|
41 |
# Remove any numbers from the column name to get the position
|
42 |
import re
|
@@ -163,6 +159,25 @@ with tab1:
|
|
163 |
st.session_state['csv_file']['Salary'] = st.session_state['csv_file']['Salary'].astype(str).str.replace(',', '').astype(int)
|
164 |
except:
|
165 |
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
166 |
|
167 |
if csv_file:
|
168 |
# st.session_state['csv_file'] = st.session_state['csv_file'].drop_duplicates(subset=['Name'])
|
|
|
33 |
player_right_names_mlb = ['Kike Hernandez', 'Joey Cantillo', 'Michael Soroka', 'Jake Bauers', 'Temi Fagbenle']
|
34 |
|
35 |
def create_position_export_dict(column_name, csv_file):
|
|
|
|
|
|
|
|
|
36 |
try:
|
37 |
# Remove any numbers from the column name to get the position
|
38 |
import re
|
|
|
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'])
|