Spaces:
Running
Running
James McCool
commited on
Commit
·
2c354dd
1
Parent(s):
53de179
Refactor player selection DataFrame in app.py to ensure consistent filtering by salary and position. Updated logic to apply filters correctly, enhancing data integrity and user experience in lineup creation.
Browse files
app.py
CHANGED
@@ -878,9 +878,12 @@ with tab4:
|
|
878 |
# If no teams selected, show all teams
|
879 |
if pos_select3:
|
880 |
position_mask_2 = handbuild_roo['Position'].apply(lambda x: any(pos in x for pos in pos_select3))
|
881 |
-
player_select_df =
|
882 |
else:
|
883 |
-
player_select_df =
|
|
|
|
|
|
|
884 |
|
885 |
with st.expander("Quick Fill Options"):
|
886 |
auto_team_var = st.selectbox("Auto Fill Team", options=all_teams)
|
|
|
878 |
# If no teams selected, show all teams
|
879 |
if pos_select3:
|
880 |
position_mask_2 = handbuild_roo['Position'].apply(lambda x: any(pos in x for pos in pos_select3))
|
881 |
+
player_select_df = player_select_df[position_mask_2][['Player', 'Position', 'Team', 'Team_Total', 'Opp_Total', 'Salary', 'Median', '2x%', 'Order', 'Hand', 'Own%']].drop_duplicates(subset=['Player', 'Team']).sort_values(by='Order', ascending=True).copy()
|
882 |
else:
|
883 |
+
player_select_df = player_select_df[['Player', 'Position', 'Team', 'Team_Total', 'Opp_Total', 'Salary', 'Median', '2x%', 'Order', 'Hand', 'Own%']].drop_duplicates(subset=['Player', 'Team']).copy()
|
884 |
+
|
885 |
+
player_select_df = player_select_df[player_select_df['Salary'] <= salary_var]
|
886 |
+
|
887 |
|
888 |
with st.expander("Quick Fill Options"):
|
889 |
auto_team_var = st.selectbox("Auto Fill Team", options=all_teams)
|