Spaces:
Build error
Build error
Update src/streamlit_app.py
Browse files303 unmodified lines304305306307308309303 unmodified linestrace.update(mode="lines") # remove markersst.plotly_chart(fig, use_container_width=True)# -------------------------------- Plot 7: Bubble Map of Incident Counts by Region NO MAP --------------------------------# st.markdown("<div class='sectionheader'>Crime Hotspots by Region NO MAP</div>", unsafe_allow_html=True)303 unmodified lines304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348303 unmodified linestrace.update(mode="lines") # remove markersst.plotly_chart(fig, use_container_width=True)# -------------------------------- Plot 8: Line Chart for Incident Counts by Region --------------------------------# 1. Compute counts per region and crimecounts = (df.groupby(['RegionName', 'crm_cd_desc']).size().reset_index(name='Count'))# 2. For each region, keep only its top 5 crime typestop5_per_region = (counts.groupby('RegionName', group_keys=False).apply(lambda grp: grp.nlargest(5, 'Count')))# 3. Draw a stacked bar chartfig = px.bar(top5_per_region,x='RegionName',y='Count',color='crm_cd_desc',title='Top 5 Crimes by Region',labels={'crm_cd_desc': 'Crime Type'},height=600)# 4. Tweak layout for readabilityfig.update_layout(barmode='stack',xaxis_tickangle=-45,xaxis_title='',yaxis_title='Incident Count',legend_title_text='Crime Type',margin=dict(t=50, b=150, l=50, r=50))# 5. Render in Streamlitst.plotly_chart(fig, use_container_width=True)# -------------------------------- Plot 7: Bubble Map of Incident Counts by Region NO MAP --------------------------------# st.markdown("<div class='sectionheader'>Crime Hotspots by Region NO MAP</div>", unsafe_allow_html=True)
src/streamlit_app.py+39