Spaces:
Sleeping
Sleeping
Jon Solow
commited on
Commit
·
a3ce631
1
Parent(s):
0e25142
Add filter for eligibility
Browse files- src/pages/1_Keepers.py +11 -2
src/pages/1_Keepers.py
CHANGED
@@ -63,9 +63,16 @@ def load_data():
|
|
63 |
|
64 |
|
65 |
def filtered_keeper_dataframe(data: pd.DataFrame, teams_list: list[str]):
|
66 |
-
teams_selected = st.multiselect("Team:", teams_list)
|
67 |
teams_filter = data["team_name"].isin(teams_selected) if teams_selected else data["team_name"].isin(teams_list)
|
68 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
69 |
is_advanced = st.checkbox("Show Advanced View")
|
70 |
|
71 |
id_cols = [
|
@@ -100,7 +107,9 @@ def filtered_keeper_dataframe(data: pd.DataFrame, teams_list: list[str]):
|
|
100 |
else:
|
101 |
show_columns = id_cols + cost_cols + adp_cols
|
102 |
|
103 |
-
|
|
|
|
|
104 |
st.dataframe(
|
105 |
filtered_data,
|
106 |
hide_index=True,
|
|
|
63 |
|
64 |
|
65 |
def filtered_keeper_dataframe(data: pd.DataFrame, teams_list: list[str]):
|
66 |
+
teams_selected = st.multiselect("Team:", teams_list, placeholder="Select a user team to filter")
|
67 |
teams_filter = data["team_name"].isin(teams_selected) if teams_selected else data["team_name"].isin(teams_list)
|
68 |
|
69 |
+
eligible_options = [True, False]
|
70 |
+
is_eligible_selected = st.multiselect(
|
71 |
+
"Keeper Eligible:", eligible_options, placeholder="Select True to filter eligible only"
|
72 |
+
)
|
73 |
+
eligible_filter = (
|
74 |
+
data["eligible"].isin(is_eligible_selected) if is_eligible_selected else data["eligible"].isin(eligible_options)
|
75 |
+
)
|
76 |
is_advanced = st.checkbox("Show Advanced View")
|
77 |
|
78 |
id_cols = [
|
|
|
107 |
else:
|
108 |
show_columns = id_cols + cost_cols + adp_cols
|
109 |
|
110 |
+
data_with_filters_applied = data.loc[teams_filter & eligible_filter, show_columns]
|
111 |
+
|
112 |
+
filtered_data = filter_dataframe(data_with_filters_applied)
|
113 |
st.dataframe(
|
114 |
filtered_data,
|
115 |
hide_index=True,
|