Spaces:
Build error
Build error
Update src/streamlit_app.py
Browse files- src/streamlit_app.py +0 -6
src/streamlit_app.py
CHANGED
|
@@ -249,10 +249,6 @@ line_chart
|
|
| 249 |
|
| 250 |
st.markdown(""" This plot is a line chart visualizing the annual number of incidents for the top 5 most frequent crime types over a five-year period, from 2020 to 2024. Each line represents a distinct crime type, allowing for easy comparison of trends across different categories. The x-axis represents the year, the y-axis indicates the number of incidents, and a legend identifies the color corresponding to each specific crime type: Battery - Simple Assault, Burglary From Vehicle, Theft of Identity, Vandalism - Felony , and Vehicle - Stolen. The plot highlights the fluctuations and overall trajectories of these major crime categories across the years.""")
|
| 251 |
|
| 252 |
-
### Use this one!!!
|
| 253 |
-
# Load data
|
| 254 |
-
with open("County_Boundary.geojson", "r", encoding="utf-8") as f:
|
| 255 |
-
geojson_data = json.load(f)
|
| 256 |
|
| 257 |
# Identify top 10 crime types
|
| 258 |
top_10_crimes = df['crm_cd_desc'].value_counts().nlargest(10).index.tolist()
|
|
@@ -272,8 +268,6 @@ df_filtered = df[(df['year'] == year_dropdown) & (df['crm_cd_desc'] == crime_dro
|
|
| 272 |
# Create the new folium map to make the map more interactive.
|
| 273 |
new_map = folium.Map(location=[df_filtered['lat'].mean(), df_filtered['lon'].mean()], zoom_start=10)
|
| 274 |
|
| 275 |
-
GEOJSON_PATH = Path(__file__).parent / "County_Boundary.geojson"
|
| 276 |
-
|
| 277 |
# Add county boundary
|
| 278 |
folium.GeoJson(geojson_data, name="County Boundaries").add_to(new_map)
|
| 279 |
|
|
|
|
| 249 |
|
| 250 |
st.markdown(""" This plot is a line chart visualizing the annual number of incidents for the top 5 most frequent crime types over a five-year period, from 2020 to 2024. Each line represents a distinct crime type, allowing for easy comparison of trends across different categories. The x-axis represents the year, the y-axis indicates the number of incidents, and a legend identifies the color corresponding to each specific crime type: Battery - Simple Assault, Burglary From Vehicle, Theft of Identity, Vandalism - Felony , and Vehicle - Stolen. The plot highlights the fluctuations and overall trajectories of these major crime categories across the years.""")
|
| 251 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 252 |
|
| 253 |
# Identify top 10 crime types
|
| 254 |
top_10_crimes = df['crm_cd_desc'].value_counts().nlargest(10).index.tolist()
|
|
|
|
| 268 |
# Create the new folium map to make the map more interactive.
|
| 269 |
new_map = folium.Map(location=[df_filtered['lat'].mean(), df_filtered['lon'].mean()], zoom_start=10)
|
| 270 |
|
|
|
|
|
|
|
| 271 |
# Add county boundary
|
| 272 |
folium.GeoJson(geojson_data, name="County Boundaries").add_to(new_map)
|
| 273 |
|