James McCool
commited on
Commit
·
fa47128
1
Parent(s):
6a37505
Refactor team filtering logic in 'app.py' to utilize mapping for team names, improving clarity and consistency in Showdown mode while maintaining performance.
Browse files
app.py
CHANGED
@@ -1280,7 +1280,7 @@ if selected_tab == 'Manage Portfolio':
|
|
1280 |
if type_var == 'Showdown':
|
1281 |
if cpt_flex_focus == 'CPT':
|
1282 |
remove_mask = parsed_frame.iloc[:, 0].apply(
|
1283 |
-
lambda
|
1284 |
)
|
1285 |
elif cpt_flex_focus == 'FLEX':
|
1286 |
remove_mask = parsed_frame.iloc[:, 1:].apply(
|
@@ -1301,7 +1301,7 @@ if selected_tab == 'Manage Portfolio':
|
|
1301 |
if type_var == 'Showdown':
|
1302 |
if cpt_flex_focus == 'CPT':
|
1303 |
lock_mask = parsed_frame.iloc[:, 0].apply(
|
1304 |
-
lambda
|
1305 |
)
|
1306 |
elif cpt_flex_focus == 'FLEX':
|
1307 |
lock_mask = parsed_frame.iloc[:, 1:].apply(
|
@@ -1320,15 +1320,24 @@ if selected_tab == 'Manage Portfolio':
|
|
1320 |
if team_include:
|
1321 |
if type_var == 'Showdown':
|
1322 |
if cpt_flex_focus == 'CPT':
|
1323 |
-
|
|
|
|
|
|
|
1324 |
lambda row: any(team in list(row) for team in team_include), axis=1
|
1325 |
)
|
1326 |
elif cpt_flex_focus == 'FLEX':
|
1327 |
-
|
|
|
|
|
|
|
1328 |
lambda row: any(team in list(row) for team in team_include), axis=1
|
1329 |
)
|
1330 |
elif cpt_flex_focus == 'Overall':
|
1331 |
-
|
|
|
|
|
|
|
1332 |
lambda row: any(team in list(row) for team in team_include), axis=1
|
1333 |
)
|
1334 |
else:
|
@@ -1346,15 +1355,24 @@ if selected_tab == 'Manage Portfolio':
|
|
1346 |
if team_remove:
|
1347 |
if type_var == 'Showdown':
|
1348 |
if cpt_flex_focus == 'CPT':
|
1349 |
-
|
|
|
|
|
|
|
1350 |
lambda row: not any(team in list(row) for team in team_remove), axis=1
|
1351 |
)
|
1352 |
elif cpt_flex_focus == 'FLEX':
|
1353 |
-
|
|
|
|
|
|
|
1354 |
lambda row: not any(team in list(row) for team in team_remove), axis=1
|
1355 |
)
|
1356 |
elif cpt_flex_focus == 'Overall':
|
1357 |
-
|
|
|
|
|
|
|
1358 |
lambda row: not any(team in list(row) for team in team_remove), axis=1
|
1359 |
)
|
1360 |
else:
|
|
|
1280 |
if type_var == 'Showdown':
|
1281 |
if cpt_flex_focus == 'CPT':
|
1282 |
remove_mask = parsed_frame.iloc[:, 0].apply(
|
1283 |
+
lambda player: not any(remove_player in str(player) for remove_player in player_remove)
|
1284 |
)
|
1285 |
elif cpt_flex_focus == 'FLEX':
|
1286 |
remove_mask = parsed_frame.iloc[:, 1:].apply(
|
|
|
1301 |
if type_var == 'Showdown':
|
1302 |
if cpt_flex_focus == 'CPT':
|
1303 |
lock_mask = parsed_frame.iloc[:, 0].apply(
|
1304 |
+
lambda player: any(lock_player in str(player) for lock_player in player_lock)
|
1305 |
)
|
1306 |
elif cpt_flex_focus == 'FLEX':
|
1307 |
lock_mask = parsed_frame.iloc[:, 1:].apply(
|
|
|
1320 |
if team_include:
|
1321 |
if type_var == 'Showdown':
|
1322 |
if cpt_flex_focus == 'CPT':
|
1323 |
+
team_frame = parsed_frame.iloc[:, 0].apply(
|
1324 |
+
lambda x: x.map(st.session_state['map_dict']['team_map'])
|
1325 |
+
)
|
1326 |
+
include_mask = team_frame.apply(
|
1327 |
lambda row: any(team in list(row) for team in team_include), axis=1
|
1328 |
)
|
1329 |
elif cpt_flex_focus == 'FLEX':
|
1330 |
+
team_frame = parsed_frame.iloc[:, 1:].apply(
|
1331 |
+
lambda x: x.map(st.session_state['map_dict']['team_map'])
|
1332 |
+
)
|
1333 |
+
include_mask = team_frame.apply(
|
1334 |
lambda row: any(team in list(row) for team in team_include), axis=1
|
1335 |
)
|
1336 |
elif cpt_flex_focus == 'Overall':
|
1337 |
+
team_frame = parsed_frame[st.session_state['player_columns']].apply(
|
1338 |
+
lambda x: x.map(st.session_state['map_dict']['team_map'])
|
1339 |
+
)
|
1340 |
+
include_mask = team_frame.apply(
|
1341 |
lambda row: any(team in list(row) for team in team_include), axis=1
|
1342 |
)
|
1343 |
else:
|
|
|
1355 |
if team_remove:
|
1356 |
if type_var == 'Showdown':
|
1357 |
if cpt_flex_focus == 'CPT':
|
1358 |
+
team_frame = parsed_frame.iloc[:, 0].apply(
|
1359 |
+
lambda x: x.map(st.session_state['map_dict']['team_map'])
|
1360 |
+
)
|
1361 |
+
remove_mask = team_frame.apply(
|
1362 |
lambda row: not any(team in list(row) for team in team_remove), axis=1
|
1363 |
)
|
1364 |
elif cpt_flex_focus == 'FLEX':
|
1365 |
+
team_frame = parsed_frame.iloc[:, 1:].apply(
|
1366 |
+
lambda x: x.map(st.session_state['map_dict']['team_map'])
|
1367 |
+
)
|
1368 |
+
remove_mask = team_frame.apply(
|
1369 |
lambda row: not any(team in list(row) for team in team_remove), axis=1
|
1370 |
)
|
1371 |
elif cpt_flex_focus == 'Overall':
|
1372 |
+
team_frame = parsed_frame[st.session_state['player_columns']].apply(
|
1373 |
+
lambda x: x.map(st.session_state['map_dict']['team_map'])
|
1374 |
+
)
|
1375 |
+
remove_mask = team_frame.apply(
|
1376 |
lambda row: not any(team in list(row) for team in team_remove), axis=1
|
1377 |
)
|
1378 |
else:
|