wanwanlin0521 commited on
Commit
1d83e1c
·
verified ·
1 Parent(s): ccb2b17

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +3 -0
src/streamlit_app.py CHANGED
@@ -264,6 +264,9 @@ years = sorted(df['year'].unique())
264
  year_dropdown = st.selectbox("Year: ", years)
265
  crime_dropdown = st.selectbox("Crime Type: ", top_10_crimes)
266
 
 
 
 
267
  # Create the new folium map to make the map more interactive.
268
  new_map = folium.Map(location=[df_filtered['lat'].mean(), df_filtered['lon'].mean()], zoom_start=10)
269
 
 
264
  year_dropdown = st.selectbox("Year: ", years)
265
  crime_dropdown = st.selectbox("Crime Type: ", top_10_crimes)
266
 
267
+ # Filter data.
268
+ df_filtered = df[(df['year'] == year_dropdown) & (df['crm_cd_desc'] == crime_dropdown)].sample(n=300, random_state=1)
269
+
270
  # Create the new folium map to make the map more interactive.
271
  new_map = folium.Map(location=[df_filtered['lat'].mean(), df_filtered['lon'].mean()], zoom_start=10)
272