add list filtering
Browse files- appStore/target.py +11 -1
appStore/target.py
CHANGED
@@ -20,7 +20,8 @@ from pandas.api.types import (
|
|
20 |
is_categorical_dtype,
|
21 |
is_datetime64_any_dtype,
|
22 |
is_numeric_dtype,
|
23 |
-
is_object_dtype,
|
|
|
24 |
|
25 |
# Declare all the necessary variables
|
26 |
classifier_identifier = 'target'
|
@@ -216,6 +217,15 @@ def filter_dataframe(df: pd.DataFrame) -> pd.DataFrame:
|
|
216 |
step=step,
|
217 |
)
|
218 |
df = df[df[column].between(*user_num_input)]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
219 |
# elif is_datetime64_any_dtype(df[column]):
|
220 |
# user_date_input = right.date_input(
|
221 |
# f"Values for {column}",
|
|
|
20 |
is_categorical_dtype,
|
21 |
is_datetime64_any_dtype,
|
22 |
is_numeric_dtype,
|
23 |
+
is_object_dtype,
|
24 |
+
is_list_like)
|
25 |
|
26 |
# Declare all the necessary variables
|
27 |
classifier_identifier = 'target'
|
|
|
217 |
step=step,
|
218 |
)
|
219 |
df = df[df[column].between(*user_num_input)]
|
220 |
+
elif is_list_like(df[column]):
|
221 |
+
list_vals = set(tuple(x) for x in df[column].tolist())
|
222 |
+
user_multi_input = right.multiselect(
|
223 |
+
f"Values for {column}",
|
224 |
+
list_vals,
|
225 |
+
default=list_vals,
|
226 |
+
)
|
227 |
+
df = df[df[column].str.contains(user_multi_input)]
|
228 |
+
# df[df[column].between(*user_num_input)]
|
229 |
# elif is_datetime64_any_dtype(df[column]):
|
230 |
# user_date_input = right.date_input(
|
231 |
# f"Values for {column}",
|