在Google Colab平台上的Jupyter Notebook中显示/渲染HTML文件 [英] Display / Render an HTML file inside Jupyter Notebook on Google Colab platform
问题描述
我正在使用Google Colab使用Python 3.0创建地图,而我已经使用底图进行了创建.接下来,我尝试使用Google地图创建类似的地图.我找到了两个python软件包,即gmaps和gmplot.似乎gmaps需要使用Google API,但gmplot不需要,因此我正在使用gmplot.
I am using Google Colab to work create maps with Python 3.0 and I have done so using Basemaps. I am next trying to create similar maps using Google Maps. There are two python packages that I have located namely gmaps and gmplot. It seems as if gmaps requires a google API but gmplot does not hence I am using gmplot.
使用gmplot,我可以创建文件"my_map.html",如果将其下载到本地桌面,则可以在浏览器中打开并正确查看地图.
With gmplot, I am able to create a file 'my_map.html' which if I download to my local desktop, I can open in a browser and see the map correctly.
但是,我希望在笔记本计算机输出单元中查看地图,而无需下载到本地计算机.下图是我尝试过的屏幕截图...没有错误,但也没有显示.
However I would like to see the map in the notebook output cell without downloading to the local machine. The following image is a screenshot of what I have tried ... there is no error, but no display either.
是否有一些命令,例如%matplotlib inline,需要执行才能在输出单元格中显示文件的内容?还是有更好的解决方案
is there some command like %matplotlib inline that i need execute to be able to display the contents of the file in the output cell? or is there a better solution
推荐答案
尝试文件的完整路径:/content/my_map.html
Try full path to your file: /content/my_map.html
代码应为:
import IPython
IPython.display.HTML(filename='/path/to/your/filename')
这篇关于在Google Colab平台上的Jupyter Notebook中显示/渲染HTML文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!