Ashoka74 commited on
Commit
7364101
·
verified ·
1 Parent(s): 07750db

Make filters allow categorical values

Browse files
Files changed (1) hide show
  1. app.py +1 -1
app.py CHANGED
@@ -1117,7 +1117,7 @@ def filter_dataframe(df: pd.DataFrame) -> pd.DataFrame:
1117
  for column in to_filter_columns:
1118
  left, right = st.columns((1, 20))
1119
  # Treat columns with < 200 unique values as categorical if not date or numeric
1120
- if is_categorical_dtype(df_[column]) :# or (df_[column].nunique() < 200 and not is_datetime64_any_dtype(df_[column]) and not is_numeric_dtype(df_[column])):
1121
  user_cat_input = right.multiselect(
1122
  f"Values for {column}",
1123
  df_[column].unique(),
 
1117
  for column in to_filter_columns:
1118
  left, right = st.columns((1, 20))
1119
  # Treat columns with < 200 unique values as categorical if not date or numeric
1120
+ if is_categorical_dtype(df_[column]) or (df_[column].nunique() < 120 and not is_datetime64_any_dtype(df_[column]) and not is_numeric_dtype(df_[column])):
1121
  user_cat_input = right.multiselect(
1122
  f"Values for {column}",
1123
  df_[column].unique(),