空叶热图

2024-06-28 21:18:53 发布

您现在位置:Python中文网/ 问答频道 /正文

我不确定为什么输出只是热图WithTime的空白,但热图工作良好。我用http://nbviewer.jupyter.org/github/python-visualization/folium/blob/master/examples/HeatMapWithTime.ipynb作为参考点

df_cord2['weight'] = 1
cord_heat2 = df_cord2[['Lat','Long','weight']][0:100].values
date = df_cord2['date'][0:100]
print(date[:5]):

0   2018-11-17
1   2018-11-17
2   2018-11-17
3   2018-11-17
4   2018-11-17
Name: date, dtype: datetime64[ns]

print(cord_heat2[:5]):
[[  34.1016 -118.3295    1.    ]
 [  33.7115 -118.2879    1.    ]
 [  34.0849 -118.3028    1.    ]
 [  33.8637 -118.2905    1.    ]
 [  34.0436 -118.2354    1.    ]]


LA_coord = (34.0522,-118.243683)

m2= folium.Map(location=LA_coord,tiles= "Stamen Terrain",zoom_start=11)

hm = plugins.HeatMapWithTime(cord_heat2,index=date,auto_play=True)
hm.add_to(m2)

m2

我错过了什么?在

编辑:过了好几个小时,终于找出了问题所在。必须为cord_heat2创建一个列表类型

^{pr2}$

Tags: dfdatela热图printweightcoordhm