Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,28 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pandas as pd
|
3 |
+
import folium
|
4 |
+
|
5 |
+
# Define the data for top ten cities in India
|
6 |
+
data = {
|
7 |
+
'City': ['Mumbai', 'Delhi', 'Bangalore', 'Hyderabad', 'Ahmedabad', 'Chennai', 'Kolkata', 'Surat', 'Pune', 'Jaipur'],
|
8 |
+
'Latitude': [19.0760, 28.7041, 12.9716, 17.3850, 23.0225, 13.0827, 22.5726, 21.1702, 18.5204, 26.9124],
|
9 |
+
'Longitude': [72.8777, 77.1025, 77.5946, 78.4867, 72.5714, 80.2707, 88.3639, 72.8311, 73.8567, 75.7873]
|
10 |
+
}
|
11 |
+
|
12 |
+
# Create a pandas DataFrame from the data
|
13 |
+
df = pd.DataFrame(data)
|
14 |
+
|
15 |
+
# Render the map of India using Folium
|
16 |
+
india_map = folium.Map(location=[20.5937, 78.9629], zoom_start=5)
|
17 |
+
|
18 |
+
# Plot markers for each city on the map
|
19 |
+
for i in range(len(df)):
|
20 |
+
folium.Marker(
|
21 |
+
location=[df['Latitude'][i], df['Longitude'][i]],
|
22 |
+
popup=df['City'][i]
|
23 |
+
).add_to(india_map)
|
24 |
+
|
25 |
+
# Display the map using Streamlit
|
26 |
+
st.title('Top Ten Cities in India')
|
27 |
+
st.write("Map showing the top ten cities in India:")
|
28 |
+
st.write(india_map)
|