AttributeError: 'function' object has no attribute 'values' heatmap
AttributeError: 'function' object has no attribute 'values' heatmap
我正在尝试使用以下代码绘制热图:
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)
数据框看起来像这样:
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
但我收到此错误:
---------------------------------------------------------------------------
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'
知道背后的原因以及如何解决吗?
谢谢
更新:
我用过 dataM['latitude'], dataM['longitude'], dataM['count']
并且有效:))
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)
我正在尝试使用以下代码绘制热图:
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)
数据框看起来像这样:
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
但我收到此错误:
---------------------------------------------------------------------------
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'
知道背后的原因以及如何解决吗? 谢谢
更新:
我用过 dataM['latitude'], dataM['longitude'], dataM['count']
并且有效:))
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)