alisharawat commited on
Commit
96b668f
·
verified ·
1 Parent(s): 2070a46

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +15 -2
src/streamlit_app.py CHANGED
@@ -142,6 +142,19 @@ def load_data():
142
 
143
  df = load_data()
144
 
 
 
 
 
 
 
 
 
 
 
 
 
 
145
  # -------------------------
146
  # Page header + sidebar
147
  # -------------------------
@@ -228,7 +241,7 @@ with main_col:
228
  zoom=10,
229
  height=600,
230
  )
231
- fig_map.update_traces(marker=dict(color="#ff4b4b"))
232
  fig_map.update_layout(mapbox_style="open-street-map", margin={"r":0,"t":0,"l":0,"b":0})
233
  st.plotly_chart(fig_map, use_container_width=True)
234
  st.caption("Map shows parks with at least one program in the current filter; bubble size ~ number of programs.")
@@ -236,7 +249,7 @@ with main_col:
236
  st.warning("No geographic coordinates found in the loaded dataset. Try using the bar chart view instead.")
237
  else:
238
  # Bar chart: top parks by program count
239
- agg = filtered.groupby("park_name").size().reset_index(name="count").sort_values("count", ascending=False)
240
  # Keep top N for readability
241
  top_n = 25
242
  agg_top = agg.head(top_n)
 
142
 
143
  df = load_data()
144
 
145
+
146
+ #CHANGED THIS!
147
+ # Robust park name using 'Location Facility'
148
+ if "Location Facility" in df.columns:
149
+ df["park_name"] = (
150
+ df["Location Facility"]
151
+ .astype(str)
152
+ .replace(["", "nan", "None"], "Unknown Park")
153
+ )
154
+ else:
155
+ df["park_name"] = "Unknown Park"
156
+
157
+
158
  # -------------------------
159
  # Page header + sidebar
160
  # -------------------------
 
241
  zoom=10,
242
  height=600,
243
  )
244
+ fig_map.update_traces(marker=dict(color="#00e5ff"))
245
  fig_map.update_layout(mapbox_style="open-street-map", margin={"r":0,"t":0,"l":0,"b":0})
246
  st.plotly_chart(fig_map, use_container_width=True)
247
  st.caption("Map shows parks with at least one program in the current filter; bubble size ~ number of programs.")
 
249
  st.warning("No geographic coordinates found in the loaded dataset. Try using the bar chart view instead.")
250
  else:
251
  # Bar chart: top parks by program count
252
+ agg = filtered.groupby("park_name").size().reset_index(name="count") #HERE 2!!
253
  # Keep top N for readability
254
  top_n = 25
255
  agg_top = agg.head(top_n)