Created
April 23, 2020 01:06
-
-
Save sergiolucero/bea138a23ff92684664b11ad8c3c42ec to your computer and use it in GitHub Desktop.
Mapping Italian COVID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import folium, pandas as pd | |
from folium.plugins import MarkerCluster | |
pdf = pd.read_json('https://tinyurl.com/covid19-github') | |
pdf = pdf[pdf.data==pdf.data.max()] | |
pdf = pdf[pdf.totale_casi>0] | |
centroid = pdf.describe()[['lat','long']].loc['50%'].values | |
fm = folium.Map(location=centroid, zoom_start=6, tiles='stamentoner', | |
width=800, height=600) | |
mc = MarkerCluster() | |
for row in pdf.itertuples(): | |
mc.add_child(folium.Marker(location=[row.lat,row.long], | |
popup=row.denominazione_provincia)) | |
mc.add_to(fm) | |
fm |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment