Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -88,6 +88,10 @@ if viz_type == "Complaints Over Time":
|
|
| 88 |
start_date = st.sidebar.date_input("Start Date", pd.to_datetime("2020-01-01"))
|
| 89 |
end_date = st.sidebar.date_input("End Date", pd.to_datetime("2024-12-31"))
|
| 90 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 91 |
# Dropdown for Housing Block (only show when Complaints by Housing Block and Type is selected)
|
| 92 |
if viz_type == "Complaints by Housing Block and Type":
|
| 93 |
block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
|
|
@@ -210,7 +214,7 @@ elif viz_type == "Geographic Distribution":
|
|
| 210 |
# **Color Scheme:**
|
| 211 |
# Each resolution status is represented by a distinct color, making it easy to differentiate between categories and quickly interpret the data.
|
| 212 |
# """)
|
| 213 |
-
|
| 214 |
|
| 215 |
# Submission Methods Analysis
|
| 216 |
elif viz_type == "Submission Methods":
|
|
@@ -293,7 +297,7 @@ elif viz_type == "Complaints by Disposition":
|
|
| 293 |
|
| 294 |
st.write("""
|
| 295 |
**What this visualization shows:**
|
| 296 |
-
This stacked bar chart displays the distribution of complaints by their disposition
|
| 297 |
|
| 298 |
**Why it's interesting:**
|
| 299 |
By combining complaint type and resolution status, this chart allows organizations to assess not only how many complaints are resolved or unresolved but also which types of complaints are most frequently resolved or still pending. This helps in identifying patterns in complaint resolution and provides insights into which complaint categories may need more attention to resolve.
|
|
@@ -349,7 +353,7 @@ elif viz_type == "Complaints Over Time":
|
|
| 349 |
complaints_over_time = filtered_data_time.groupby(filtered_data_time['Date Reported'].dt.date).size()
|
| 350 |
|
| 351 |
fig, ax = plt.subplots()
|
| 352 |
-
ax.plot(complaints_over_time.index, complaints_over_time.values, marker='o', color='tab:
|
| 353 |
ax.set_title("Complaints Over Time")
|
| 354 |
st.pyplot(fig)
|
| 355 |
|
|
|
|
| 88 |
start_date = st.sidebar.date_input("Start Date", pd.to_datetime("2020-01-01"))
|
| 89 |
end_date = st.sidebar.date_input("End Date", pd.to_datetime("2024-12-31"))
|
| 90 |
|
| 91 |
+
# Allow the user to select the type of chart (Bar or Pie) for Submission Methods
|
| 92 |
+
if viz_type == "Submission Methods":
|
| 93 |
+
plot_type = st.sidebar.selectbox("Select Plot Type", options=["Bar Chart", "Pie Chart"])
|
| 94 |
+
|
| 95 |
# Dropdown for Housing Block (only show when Complaints by Housing Block and Type is selected)
|
| 96 |
if viz_type == "Complaints by Housing Block and Type":
|
| 97 |
block_options = ['All Blocks'] + sorted(data['Housing Block'].unique().tolist())
|
|
|
|
| 214 |
# **Color Scheme:**
|
| 215 |
# Each resolution status is represented by a distinct color, making it easy to differentiate between categories and quickly interpret the data.
|
| 216 |
# """)
|
| 217 |
+
# We collectively decided to opt for more engaging and interactive charts instead of the above chart.
|
| 218 |
|
| 219 |
# Submission Methods Analysis
|
| 220 |
elif viz_type == "Submission Methods":
|
|
|
|
| 297 |
|
| 298 |
st.write("""
|
| 299 |
**What this visualization shows:**
|
| 300 |
+
This stacked bar chart displays the distribution of complaints by their disposition for each complaint type. The bars represent different complaint categories, and each bar is broken down by the resolution status.
|
| 301 |
|
| 302 |
**Why it's interesting:**
|
| 303 |
By combining complaint type and resolution status, this chart allows organizations to assess not only how many complaints are resolved or unresolved but also which types of complaints are most frequently resolved or still pending. This helps in identifying patterns in complaint resolution and provides insights into which complaint categories may need more attention to resolve.
|
|
|
|
| 353 |
complaints_over_time = filtered_data_time.groupby(filtered_data_time['Date Reported'].dt.date).size()
|
| 354 |
|
| 355 |
fig, ax = plt.subplots()
|
| 356 |
+
ax.plot(complaints_over_time.index, complaints_over_time.values, marker='o', color='tab:purple')
|
| 357 |
ax.set_title("Complaints Over Time")
|
| 358 |
st.pyplot(fig)
|
| 359 |
|