ralate2 commited on
Commit
be94f09
·
verified ·
1 Parent(s): 1fed836

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -25
app.py CHANGED
@@ -93,33 +93,18 @@ 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=f"block_select_{viz_type}" # Unique key for each visualization
103
- # )
104
-
105
- # # Ensuring selected_block is only used if defined
106
- # 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():
107
- # selected_block = 'All Blocks' # Default to 'All Blocks' if no selection made
108
-
109
- # Dropdown for Housing Block (only show for specific visualizations)
110
- block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
111
- selected_block = 'All Blocks' # Default value
112
-
113
- if viz_type in [
114
- "Complaints by Housing Block and Type",
115
- "Complaints by Housing Block and Type (Incorporating Suggestions Based on Professor's Feedback)"
116
- ]:
117
- # Show dropdown only when required
118
  selected_block = st.sidebar.selectbox(
119
- "Select Housing Block",
120
- options=block_options,
121
- key="unique_block_select" # Fixed key to avoid duplicates
122
  )
 
 
 
 
123
 
124
  # Filtering data based on selected year
125
  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
+ # Ensuring selected_block is only used if defined
106
+ 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():
107
+ selected_block = 'All Blocks' # Default to 'All Blocks' if no selection made
108
 
109
  # Filtering data based on selected year
110
  if selected_year != 'All Time':