html不会出现在jupyter中

时间:2018-10-29 08:21:20

标签: jupyter-notebook ipython jupyter

我使用以下代码

import folium
import pandas as pd

df = pd.read_csv('meteo.csv', encoding='cp1251', sep =';')
customers = zip(df['lat'], df['lng'])
m = folium.Map(location=[70, 100], zoom_start=1)
folium.Marker(location=customers[0]).add_to(m)
folium.Marker(location=customers[1]).add_to(m)
folium.Marker(location=customers[2]).add_to(m)

m

如果标记为2,则小叶显示带有标记的地图,但是如果标记为3,则我在jupyter中看到一个空窗口,没有错误。如何解决?

此案最有可能发生在木星上。 如果我运行代码:

def embed_map(m):
    from IPython.display import HTML

    m.save('index.html')
    with open('index.html') as f:
        html = f.read()

    iframe = '<iframe srcdoc="{srcdoc}" style="width: 100%; height: 750px; border: none"></iframe>'
    srcdoc = html.replace('"', '&quot;')
    return HTML(iframe.format(srcdoc=srcdoc))


embed_map(m)

我得到了正确的html,但是它也没有出现在jupyter中。

0 个答案:

没有答案
相关问题