我正在尝试使用网站提供的 iframe 和 JS 脚本将可视化链接到 Jupyter 笔记本:https ://public.flourish.studio/visualisation/1631776/但在笔记本中出现无效语法错误。
我已经尝试如下,关于问题的任何想法?
from IPython.display import display, HTML
js = "<div class="flourish-embed flourish-bar-chart-race" data-src="visualisation/1631776">
<script src="https://public.flourish.studio/resources/embed.js"></script></div>"
display(HTML(js))
错误:
File "<ipython-input-4-5d8ce592337a>", line 2
js = "<div class="flourish-embed flourish-bar-chart-race" data-src="visualisation/1631776"><script src="https://public.flourish.studio/resources/embed.js"></script></div>"
^
SyntaxError: invalid syntax
注意:我也尝试从 git repo 加载相同的 gif,如下所示,但出现超时错误:
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
img = mpimg.imread("https://github.com/rsyed1/kaggle/blob/master/Cases2020.gif?raw=true")
plt.imshow(img)
错误:
gaierror Traceback (most recent call last)
/opt/conda/lib/python3.6/urllib/request.py in do_open(self, http_class, req, **http_conn_args)
1317 h.request(req.get_method(), req.selector, req.data, headers,
-> 1318 encode_chunked=req.has_header('Transfer-encoding'))
1319 except OSError as err: # timeout error
斯蒂芬大帝
相关分类