Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -70,12 +70,24 @@ with button_col3:
|
|
| 70 |
if st.session_state.get('select_columns', False):
|
| 71 |
st.write("Please choose the 'lob' column and the values to filter by:")
|
| 72 |
|
|
|
|
|
|
|
|
|
|
| 73 |
# Dropdown to select the 'lob' column
|
| 74 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 75 |
|
| 76 |
-
#
|
| 77 |
-
|
| 78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 79 |
|
| 80 |
# Filter the DataFrame based on selected 'lob' values
|
| 81 |
if selected_lob_values:
|
|
@@ -84,8 +96,8 @@ if st.session_state.get('select_columns', False):
|
|
| 84 |
|
| 85 |
# Display other column selections after 'lob' has been selected and DataFrame has been filtered
|
| 86 |
st.write("Now, select the columns for other parameters:")
|
| 87 |
-
valuation_as_at = st.selectbox('Valuation As At:', filtered_df.columns)
|
| 88 |
-
quarter_bracket = st.selectbox('Quarter Bracket:', filtered_df.columns)
|
| 89 |
# Continue with other selections as required...
|
| 90 |
|
| 91 |
# Store the column selections in the session state
|
|
|
|
| 70 |
if st.session_state.get('select_columns', False):
|
| 71 |
st.write("Please choose the 'lob' column and the values to filter by:")
|
| 72 |
|
| 73 |
+
# Create two columns: one for the 'lob' column dropdown, one for the checkboxes
|
| 74 |
+
col1, col2 = st.columns(2)
|
| 75 |
+
|
| 76 |
# Dropdown to select the 'lob' column
|
| 77 |
+
with col1:
|
| 78 |
+
lob_column = st.selectbox('Choose the column for "lob":', st.session_state['premiums_df'].columns, key='lob_column')
|
| 79 |
+
|
| 80 |
+
# Initialize an empty list to hold the selected values
|
| 81 |
+
selected_lob_values = []
|
| 82 |
|
| 83 |
+
# Generate checkboxes for each unique value in the 'lob' column
|
| 84 |
+
with col2:
|
| 85 |
+
st.write("Select values for filtering:")
|
| 86 |
+
if 'lob_column' in st.session_state and st.session_state['lob_column'] in st.session_state['premiums_df'].columns:
|
| 87 |
+
for value in st.session_state['premiums_df'][st.session_state['lob_column']].unique():
|
| 88 |
+
# Create a checkbox for each unique value in the 'lob' column
|
| 89 |
+
if st.checkbox(f"{value}", key=f"checkbox_{value}"):
|
| 90 |
+
selected_lob_values.append(value)
|
| 91 |
|
| 92 |
# Filter the DataFrame based on selected 'lob' values
|
| 93 |
if selected_lob_values:
|
|
|
|
| 96 |
|
| 97 |
# Display other column selections after 'lob' has been selected and DataFrame has been filtered
|
| 98 |
st.write("Now, select the columns for other parameters:")
|
| 99 |
+
valuation_as_at = st.selectbox('Valuation As At:', filtered_df.columns, key='valuation_as_at')
|
| 100 |
+
quarter_bracket = st.selectbox('Quarter Bracket:', filtered_df.columns, key='quarter_bracket')
|
| 101 |
# Continue with other selections as required...
|
| 102 |
|
| 103 |
# Store the column selections in the session state
|