Folium map issue in PyCharm

只谈情不闲聊 提交于 2020-04-18 05:48:39

问题


I am using Pycharm and the folium maps are not being displayed. My code is as follows:

import folium
from folium import plugins
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
from IPython.core.display import display, HTML

m = folium.Map([52.5, 2], zoom_start=5.5)
display(m)

But I am able to save it as html and it is correctly displayed in html.

m.save('aee.html')

回答1:


You can't open the map directly in pycharm. Yet, as you stated you can make an HTML File of it.

Here's a little function to auto-open it in browser:

    def auto_open(path):
        html_page = f'{path}'
        f_map.save(html_page)
        # open in browser.
        new = 2
        webbrowser.open(html_page, new=new)

I'm using fuliom like this in a Django app, it's quite useful as render tool as well.

Folium also provides ability to save the map to images, check it out.



来源:https://stackoverflow.com/questions/61099551/folium-map-issue-in-pycharm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!