Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -161,18 +161,10 @@ def column_selection_ui(dataframe_key, selection_key):
|
|
| 161 |
if not any(not isinstance(x, str) or is_mostly_numeric(x) for x in st.session_state[dataframe_key][col].dropna())
|
| 162 |
]
|
| 163 |
|
| 164 |
-
# Restore previous selections if they exist
|
| 165 |
-
previous_selections = st.session_state.get(f'{selection_key}_selections', {})
|
| 166 |
-
|
| 167 |
col1, col2 = st.columns(2)
|
| 168 |
with col1:
|
| 169 |
-
lob_column = st.selectbox(
|
| 170 |
-
|
| 171 |
-
string_columns,
|
| 172 |
-
key=f'lob_column_{selection_key}',
|
| 173 |
-
index=string_columns.index(previous_selections.get('lob_column')) if previous_selections.get('lob_column') in string_columns else 0
|
| 174 |
-
)
|
| 175 |
-
selected_lob_values = previous_selections.get('selected_lob_values', [])
|
| 176 |
|
| 177 |
with col2:
|
| 178 |
st.write("Select values for filtering:")
|
|
@@ -180,12 +172,12 @@ def column_selection_ui(dataframe_key, selection_key):
|
|
| 180 |
unique_values = st.session_state[dataframe_key][lob_column].unique()
|
| 181 |
unique_values.sort()
|
| 182 |
for value in unique_values:
|
| 183 |
-
|
| 184 |
-
|
| 185 |
-
|
| 186 |
-
|
| 187 |
-
|
| 188 |
-
|
| 189 |
|
| 190 |
# Filter the DataFrame based on selected 'lob' values
|
| 191 |
if selected_lob_values:
|
|
|
|
| 161 |
if not any(not isinstance(x, str) or is_mostly_numeric(x) for x in st.session_state[dataframe_key][col].dropna())
|
| 162 |
]
|
| 163 |
|
|
|
|
|
|
|
|
|
|
| 164 |
col1, col2 = st.columns(2)
|
| 165 |
with col1:
|
| 166 |
+
lob_column = st.selectbox('Choose the column for "lob":', string_columns, key=f'lob_column_{selection_key}')
|
| 167 |
+
selected_lob_values = []
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 168 |
|
| 169 |
with col2:
|
| 170 |
st.write("Select values for filtering:")
|
|
|
|
| 172 |
unique_values = st.session_state[dataframe_key][lob_column].unique()
|
| 173 |
unique_values.sort()
|
| 174 |
for value in unique_values:
|
| 175 |
+
if st.checkbox(f"{value}", key=f"checkbox_{value}_{selection_key}"):
|
| 176 |
+
selected_lob_values.append(value)
|
| 177 |
+
|
| 178 |
+
# Initialize the variables to prevent UnboundLocalError
|
| 179 |
+
valuation_as_at = None
|
| 180 |
+
quarter_bracket = None
|
| 181 |
|
| 182 |
# Filter the DataFrame based on selected 'lob' values
|
| 183 |
if selected_lob_values:
|