James McCool
commited on
Commit
·
b6cd6af
1
Parent(s):
5a83748
Remove NASCAR table display from app.py to streamline portfolio presentation and improve user experience. Update name mapping logic in load_dk_fd_file.py to enhance ID handling and ensure cleaner data output.
Browse files- app.py +0 -2
- global_func/load_dk_fd_file.py +12 -1
app.py
CHANGED
@@ -130,8 +130,6 @@ with tab1:
|
|
130 |
st.success('Portfolio file loaded successfully!')
|
131 |
st.session_state['portfolio'] = st.session_state['portfolio'].apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
|
132 |
st.dataframe(st.session_state['portfolio'].head(10))
|
133 |
-
if sport_var == 'NASCAR':
|
134 |
-
st.table(st.session_state['portfolio'].head(500))
|
135 |
|
136 |
with col3:
|
137 |
st.subheader("Projections File")
|
|
|
130 |
st.success('Portfolio file loaded successfully!')
|
131 |
st.session_state['portfolio'] = st.session_state['portfolio'].apply(lambda x: x.replace(player_wrong_names_mlb, player_right_names_mlb))
|
132 |
st.dataframe(st.session_state['portfolio'].head(10))
|
|
|
|
|
133 |
|
134 |
with col3:
|
135 |
st.subheader("Projections File")
|
global_func/load_dk_fd_file.py
CHANGED
@@ -38,7 +38,18 @@ def load_dk_fd_file(lineups, csv_file):
|
|
38 |
|
39 |
# Map the IDs to names
|
40 |
for col in lineups_df.columns:
|
41 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
|
43 |
return export_df, lineups_df
|
44 |
|
|
|
38 |
|
39 |
# Map the IDs to names
|
40 |
for col in lineups_df.columns:
|
41 |
+
def map_or_clean(value):
|
42 |
+
# First try to map using the dictionary
|
43 |
+
if value in name_dict:
|
44 |
+
return name_dict[value]
|
45 |
+
else:
|
46 |
+
# If no match found, remove the ID portion
|
47 |
+
match = re.search(r' \(', str(value))
|
48 |
+
if match:
|
49 |
+
return str(value)[:match.start()]
|
50 |
+
return value
|
51 |
+
|
52 |
+
lineups_df[col] = lineups_df[col].apply(map_or_clean)
|
53 |
|
54 |
return export_df, lineups_df
|
55 |
|