[GIS] Folium Heat Maps

foliumheat mappythonweb-mapping

I am trying to replicate the following heatmap from this link.
Seems simple, but my html output is just a tile map with none of the data I'm trying to represent.

Here's what my csv data looks like for_map:

enter image description here

And here is my code:

from folium import FeatureGroup, LayerControl, Map, Marker
from folium.plugins import HeatMap

for_map = pd.read_csv('ny_tickets_coord.csv', sep=';')

hmap = folium.Map(location=ny_coord, zoom_start=12)


hm_wide = HeatMap( zip(for_map.Y.values, for_map.X.values),
                     min_opacity=0.2,
                     radius=17, blur=15,
                     max_zoom=1
                 )
hmap.add_child(hm_wide)
hmap.save('heatmap.html')

Any ideas as to why my data is not showing up in the map?

Best Answer

Apologies for the thread necromancy, but after having had to Google this for the Nth time, I wanted to go ahead and record here that the only thing wrong with the OP's code here is that HeatMap wants a list, not an iterator. It should be:

hm_wide = HeatMap( list(zip(for_map.Y.values, for_map.X.values)),
                     min_opacity=0.2,
                     radius=17, blur=15,
                     max_zoom=1 
                 )