问题如下图所示
def df_to_html(df, out_fname, detail=0, bbox=None):
c_lng, c_lat = df.iloc[0]['Longitude'], df.iloc[0]['Latitude']
html = const_prefix % (c_lat, c_lng)
for i in range(len(df)):
lng, lat = df.iloc[i]['Longitude'], df.iloc[i]['Latitude']
marker = '[%s, %s]' % (lat, lng)
if bbox is None or (bbox is not None and bbox[0][0] <= lat <= bbox[1][0] and bbox[0][1] <= lng <= bbox[1][1]):
if detail:
html += const_circle_pop % (marker, 'red', 2, i)
else:
html += const_circle % (marker, 'red', 2)
html += const_suffix
with open(out_fname, 'w') as o_file:
o_file.write(html)