JUNGU commited on
Commit
13728df
·
verified ·
1 Parent(s): 9a5311f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -151,7 +151,7 @@ def update_filtered_data():
151
 
152
  def create_slicers(data):
153
  for col in st.session_state.categorical_columns:
154
- if data[col].nunique() <= 10:
155
  st.session_state.slicers[col] = st.multiselect(
156
  f"{col} 선택",
157
  options=sorted(data[col].unique()),
@@ -163,7 +163,7 @@ def create_slicers(data):
163
  def apply_slicers(data):
164
  filtered_data = data.copy()
165
  for col, selected_values in st.session_state.slicers.items():
166
- if selected_values:
167
  filtered_data = filtered_data[filtered_data[col].isin(selected_values)]
168
  return filtered_data
169
 
 
151
 
152
  def create_slicers(data):
153
  for col in st.session_state.categorical_columns:
154
+ if col in data.columns and data[col].nunique() <= 10:
155
  st.session_state.slicers[col] = st.multiselect(
156
  f"{col} 선택",
157
  options=sorted(data[col].unique()),
 
163
  def apply_slicers(data):
164
  filtered_data = data.copy()
165
  for col, selected_values in st.session_state.slicers.items():
166
+ if col in filtered_data.columns and selected_values:
167
  filtered_data = filtered_data[filtered_data[col].isin(selected_values)]
168
  return filtered_data
169