jupyter / notebook

Jupyter Interactive Notebook
https://jupyter-notebook.readthedocs.io/
BSD 3-Clause "New" or "Revised" License
11.73k stars 4.96k forks source link

html does not appear in jupyter #4153

Open mybox2003 opened 6 years ago

mybox2003 commented 6 years ago

I use the following code

 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[3]).add_to(m)

    m

if markers are 2, then the folium displays a map with markers, but if markers are 3 or or more, then I see an empty window in jupyter, there are no errors. How to fix it?

The case is most likely in Jupiter. If I run the code:

    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)

I get the correct html, but it also does not appear in jupyter.

takluyver commented 6 years ago

Check the browser's Javascript console to see if there are any errors there.

mybox2003 commented 6 years ago

there are no errors