Spaces:
Build error
Build error
Update src/streamlit_app.py
Browse files130 unmodified lines13113213313413513613725 unmodified lines16316416516616716816917032 unmodified lines20320420520620720894 unmodified lines30330430530630730830931031131221 unmodified lines334335336337338339340341130 unmodified linesvalue=f"{top_share:.1%}")# Plotly donut chart ──fig = px.pie(top_crimes,names="Crime Type",25 unmodified lines# -------------------------------- Plot 2: Heat Map --------------------------------top_crimes = df['crm_cd_desc'].value_counts().nlargest(10).indexdf_top = df[df['crm_cd_desc'].isin(top_crimes)]# Count the crime type and list out the top 10 crime type that have the most cases.top_crimes = df['crm_cd_desc'].value_counts().nlargest(10).index32 unmodified lines# -------------------------------- Plot 3: Line Chart --------------------------------df = df[df['year'] != 2025] # 2025 is not end, so the trend can't be see# Group the each crime type by year.94 unmodified lines""")# -------------------------------- Plot 4: Stacked Bar Chart --------------------------------# Count the crime type and list out the top 10 crime type that have the most cases.top_crimes = df['crm_cd_desc'].value_counts().nlargest(10).indexdf = df[df['year'] != 2025]df_top = df[df['crm_cd_desc'].isin(top_crimes)]# Group by crime type and year.stacked_year_df = df_top.groupby(['year', 'crm_cd_desc']).size().reset_index(name='count')21 unmodified lines""")# -------------------------------- Plot 5: Bar Chart --------------------------------top_crimes = df['crm_cd_desc'].value_counts().nlargest(10).indexdf_top = df[df['crm_cd_desc'].isin(top_crimes)]# Group by crime type and year.heatmap1_df = df_top.groupby(['crm_cd_desc', 'year']).size().reset_index(name='count')130 unmodified lines13113213313413513613725 unmodified lines16316416516616716832 unmodified lines20120220320420520620794 unmodified lines30230330430530630730830931031131231321 unmodified lines335336337338339340341342130 unmodified linesvalue=f"{top_share:.1%}")# -------------------------------- Plot 1: Pie(Donut) Chart --------------------------------fig = px.pie(top_crimes,names="Crime Type",25 unmodified lines# -------------------------------- Plot 2: Heat Map --------------------------------# Count the crime type and list out the top 10 crime type that have the most cases.top_crimes = df['crm_cd_desc'].value_counts().nlargest(10).index32 unmodified lines# -------------------------------- Plot 3: Line Chart --------------------------------# Filter out the year 2025.df = df[df['year'] != 2025] # 2025 is not end, so the trend can't be see# Group the each crime type by year.94 unmodified lines""")# -------------------------------- Plot 4: Stacked Bar Chart --------------------------------# # Filter out the year 2025.# df = df[df['year'] != 2025]# # Count the crime type and list out the top 10 crime type that have the most cases.# top_crimes = df['crm_cd_desc'].value_counts().nlargest(10).index# df_top = df[df['crm_cd_desc'].isin(top_crimes)]# Group by crime type and year.stacked_year_df = df_top.groupby(['year', 'crm_cd_desc']).size().reset_index(name='count')21 unmodified lines""")# -------------------------------- Plot 5: Bar Chart --------------------------------# top_crimes = df['crm_cd_desc'].value_counts().nlargest(10).index# df_top = df[df['crm_cd_desc'].isin(top_crimes)]# Group by crime type and year.heatmap1_df = df_top.groupby(['crm_cd_desc', 'year']).size().reset_index(name='count')
src/streamlit_app.py+10-9