'AttributeError: 'function' object has no attribute 'values' heatmap
I'm trying to plot a heatmap using this code:
import folium
from folium.plugins import HeatMap
max_Count = (dataM['count'].max())
hmap = folium.Map(location=[53.192838, 8.197006], zoom_start=7,)
hm_wide = HeatMap( list(zip(dataM.latitude.values, dataM.longitude.values, dataM.count.values)),
min_opacity=0.2,
max_val=max_Count,
radius=17, blur=15,
max_zoom=1,
)
hmap.add_child(hm_wide)
the dataframe looks like that:
station count latitude longitude city
Time
2021-05-01 00:00:00 02-MI-JAN-N 11.0 52.5139 13.41780 Berlin
2021-05-01 00:00:00 24-MH-ALB 0.0 52.4925 13.55850 Berlin
2021-05-01 00:00:00 23-TK-KAI 1.0 52.4573 13.51870 Berlin
... ... ... ... ... ...
2021-09-09 23:45:00 50801_Amalienstr 0.0 53.1390 8.22225 Oldenburg
but i'm getting this error:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-23-c1b7a410c325> in <module>
5 hmap = folium.Map(location=[53.192838, 8.197006], zoom_start=7,)
6
----> 7 hm_wide = HeatMap( list(zip(dataM.latitude.values, dataM.longitude.values, dataM.count.values)),
8 min_opacity=0.2,
9 max_val=max_Count,
AttributeError: 'function' object has no attribute 'values'
Any idea about the reason behind it and how can it be solved? Thank you
UPDATE:
I've used dataM['latitude'], dataM['longitude'], dataM['count'] and it works :))
Solution 1:[1]
import folium
from folium.plugins import HeatMap
max_Count = (dataM['count'].max())
hmap = folium.Map(location=[53.192838, 8.197006], zoom_start=7,)
hm_wide = HeatMap( list(zip(dataM['latitude'], dataM['longitude'], dataM['count'])),
min_opacity=0.2,
max_val=max_Count,
radius=17, blur=15,
max_zoom=1,
)
hmap.add_child(hm_wide)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Hermion |
