数据(马里布海滩,商业和长滩)从Excel中加载弹出窗口。我使用下面的代码,当我打开任何弹出窗口时,它以表格的形式显示(图1)。我想把它做成Spring的形式(例如:图2)。你能提示我如何做这件事吗?
import folium
import pandas as pd
import io
data = '''
Name A1 A2 A3 LAT LON
"Malibu Beach" 0.63 0.55 0.95 34.03194 -118.698387
'Commerce' 0.17 0.45 0.25 34.00031 -118.159770
"Long Beach" 0.19 0.21 0.09 33.77171 -118.181310'''
data = pd.read_csv(io.StringIO(data), delim_whitespace=True)
map = folium.Map([data.LAT.mean(),
data.LON.mean()],zoom_control=True,zoom_start = 9,scrollWheelZoom=True,tiles = "Stamen Terrain")
for i in range(len(data)):
html = data.loc[i,['Name','A1','A2','A3']].to_frame().T.to_html(
classes="table table-striped table-hover table-condensed table-responsive")
popup = folium.Popup(html, max_width=500)
folium.Marker([data.iloc[i]['LAT'], data.iloc[i]['LON']],popup =folium.Popup(html, max_width=500),icon=folium.Icon(icon='cloud',color='darkblue')).add_to(map)
map
1条答案
按热度按时间cgvd09ve1#
不要使用
.T
转置数据: