Borya-Goldarb commited on
Commit
eadf7ec
·
verified ·
1 Parent(s): 802df7d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ import pandas as pd
3
+ import folium
4
+
5
+ # Load data
6
+ data = {
7
+ 'Name': ['Location_A', 'Location_B', 'Location_C', 'Location_D', 'Location_E'],
8
+ 'latitude': np.random.uniform(40.7, 40.8, size=5), # Assuming latitude range between 40.7 and 40.8
9
+ 'longitude': np.random.uniform(-74.0, -73.9, size=5) # Assuming longitude range between -74.0 and -73.9
10
+ }
11
+
12
+ # Create DataFrame
13
+ df = pd.DataFrame(data)
14
+
15
+ # Sidebar for user input
16
+ st.sidebar.title('Filters')
17
+ selected_column = st.sidebar.selectbox('Select Column', data.columns)
18
+
19
+ # Filter data based on user selection
20
+ filtered_data = data[selected_column]
21
+
22
+ # Display the filtered data
23
+ st.write('Filtered Data:')
24
+ st.write(filtered_data)
25
+
26
+ # Create a map object
27
+ m = folium.Map(location=[filtered_data['latitude'].mean(), filtered_data['longitude'].mean()], zoom_start=10)
28
+
29
+ # Add markers to the map
30
+ for index, row in filtered_data.iterrows():
31
+ folium.Marker([row['latitude'], row['longitude']], popup=row['popup_text']).add_to(m)
32
+
33
+ # Render the map
34
+ folium_static(m)