Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -93,18 +93,29 @@ if viz_type == "Complaints Over Time":
|
|
| 93 |
start_date = st.sidebar.date_input("Start Date", pd.to_datetime("2020-01-01"), key="start_date")
|
| 94 |
end_date = st.sidebar.date_input("End Date", pd.to_datetime("2024-12-31"), key="end_date")
|
| 95 |
|
| 96 |
-
# Dropdown for Housing Block (only show when Complaints by Housing Block and Type or the updated version is selected)
|
| 97 |
-
if viz_type in ["Complaints by Housing Block and Type", "Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"]:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 98 |
block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
|
| 99 |
selected_block = st.sidebar.selectbox(
|
| 100 |
"Select Housing Block",
|
| 101 |
options=block_options,
|
| 102 |
-
key=
|
| 103 |
)
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
|
|
|
|
|
|
| 108 |
|
| 109 |
# Filtering data based on selected year
|
| 110 |
if selected_year != 'All Time':
|
|
|
|
| 93 |
start_date = st.sidebar.date_input("Start Date", pd.to_datetime("2020-01-01"), key="start_date")
|
| 94 |
end_date = st.sidebar.date_input("End Date", pd.to_datetime("2024-12-31"), key="end_date")
|
| 95 |
|
| 96 |
+
# # Dropdown for Housing Block (only show when Complaints by Housing Block and Type or the updated version is selected)
|
| 97 |
+
# if viz_type in ["Complaints by Housing Block and Type", "Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"]:
|
| 98 |
+
# block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
|
| 99 |
+
# selected_block = st.sidebar.selectbox(
|
| 100 |
+
# "Select Housing Block",
|
| 101 |
+
# options=block_options,
|
| 102 |
+
# key=f"block_select_{viz_type}" # Unique key for each visualization
|
| 103 |
+
# )
|
| 104 |
+
|
| 105 |
+
if viz_type in ["Complaints by Housing Block and Type",
|
| 106 |
+
"Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"]:
|
| 107 |
block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
|
| 108 |
selected_block = st.sidebar.selectbox(
|
| 109 |
"Select Housing Block",
|
| 110 |
options=block_options,
|
| 111 |
+
key="block_select" # Single key for the dropdown
|
| 112 |
)
|
| 113 |
+
else:
|
| 114 |
+
selected_block = 'All Blocks'
|
| 115 |
+
|
| 116 |
+
# # Ensuring selected_block is only used if defined
|
| 117 |
+
# if viz_type in ["Complaints by Housing Block and Type", "Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"] and 'selected_block' not in locals():
|
| 118 |
+
# selected_block = 'All Blocks' # Default to 'All Blocks' if no selection made
|
| 119 |
|
| 120 |
# Filtering data based on selected year
|
| 121 |
if selected_year != 'All Time':
|