Skip to content

Instantly share code, notes, and snippets.

@sergiolucero
Created April 23, 2020 01:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sergiolucero/bea138a23ff92684664b11ad8c3c42ec to your computer and use it in GitHub Desktop.
Save sergiolucero/bea138a23ff92684664b11ad8c3c42ec to your computer and use it in GitHub Desktop.
Mapping Italian COVID
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