mirror of
https://github.com/hastagAB/Awesome-Python-Scripts.git
synced 2024-11-23 20:11:07 +00:00
fix to covid visualiser, sometimes deaths are null (#139)
This commit is contained in:
parent
eff5756354
commit
31e7288881
|
@ -23,31 +23,32 @@ for i in range(1,len(statewise_covid_data)):
|
|||
mp = folium.Map(location = [city_data[1]['lat'],city_data[1]['lng']],zoom_start= 5)
|
||||
|
||||
for i in range(len(city_data)):
|
||||
if float(city_data[i]['deaths']) > 50:
|
||||
folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
|
||||
popup = city_data[i]['state'],
|
||||
icon=folium.Icon(color='darkred',icon_color='white',icon='remove-sign',),
|
||||
tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
|
||||
).add_to(mp)
|
||||
elif float(city_data[i]['deaths']) > 20:
|
||||
folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
|
||||
popup = city_data[i]['state'],
|
||||
icon=folium.Icon(color='red',icon_color='white',icon='ban-circle',),
|
||||
tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
|
||||
).add_to(mp)
|
||||
elif float(city_data[i]['deaths']) > 0:
|
||||
folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
|
||||
popup = city_data[i]['state'],
|
||||
icon=folium.Icon(color='orange',icon_color='white',icon='warning-sign',),
|
||||
tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
|
||||
).add_to(mp)
|
||||
if "deaths" in city_data[i]:
|
||||
if float(city_data[i]['deaths']) > 50:
|
||||
folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
|
||||
popup = city_data[i]['state'],
|
||||
icon=folium.Icon(color='darkred',icon_color='white',icon='remove-sign',),
|
||||
tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
|
||||
).add_to(mp)
|
||||
elif float(city_data[i]['deaths']) > 20:
|
||||
folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
|
||||
popup = city_data[i]['state'],
|
||||
icon=folium.Icon(color='red',icon_color='white',icon='ban-circle',),
|
||||
tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
|
||||
).add_to(mp)
|
||||
elif float(city_data[i]['deaths']) > 0:
|
||||
folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
|
||||
popup = city_data[i]['state'],
|
||||
icon=folium.Icon(color='orange',icon_color='white',icon='warning-sign',),
|
||||
tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
|
||||
).add_to(mp)
|
||||
|
||||
elif float(city_data[i]['deaths']) == 0:
|
||||
folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
|
||||
popup = city_data[i]['state'],
|
||||
icon=folium.Icon(color='green',icon_color='white',icon='ok-circle',),
|
||||
tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
|
||||
).add_to(mp)
|
||||
elif float(city_data[i]['deaths']) == 0:
|
||||
folium.Marker(location = [city_data[i]['lat'],city_data[i]['lng']],
|
||||
popup = city_data[i]['state'],
|
||||
icon=folium.Icon(color='green',icon_color='white',icon='ok-circle',),
|
||||
tooltip = 'deaths: ' + city_data[i]['deaths'] + ' confirmed: ' + city_data[i]['confirmed']
|
||||
).add_to(mp)
|
||||
|
||||
mp.save('map.html')
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user