Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/301.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 使用jupyter notebbok在数据框中单击链接和图像_Python_Pandas_Dataframe_Jupyter Notebook_Jupyter Lab - Fatal编程技术网

Python 使用jupyter notebbok在数据框中单击链接和图像

Python 使用jupyter notebbok在数据框中单击链接和图像,python,pandas,dataframe,jupyter-notebook,jupyter-lab,Python,Pandas,Dataframe,Jupyter Notebook,Jupyter Lab,我在jupyter笔记本中创建了以下代码来显示可点击的链接和显示图像,但两者都不起作用。链接和图像链接都仅显示为文本 from IPython.display import Image, HTML def make_clickable(val): # target _blank to open new window return '<a target="_blank" href="{}">{}</a>'.forma

我在jupyter笔记本中创建了以下代码来显示可点击的链接和显示图像,但两者都不起作用。链接和图像链接都仅显示为文本

from IPython.display import Image, HTML

def make_clickable(val):
    # target _blank to open new window
    return '<a target="_blank" href="{}">{}</a>'.format(val, val)

def show_image(val):
    return '<img src="{}>"'.format(val)

df.style.format({'link': make_clickable,'image_link': show_image})
HTML(df.to_html(escape=True))
从IPython.display导入图像,HTML
def使_可点击(val):
#目标为空以打开新窗口
返回“”。格式(val,val)
def显示图像(val):
返回''.'格式(val)
format({'link':使_可点击,'image_link':show_image})
HTML(df.to_HTML(escape=True))

对于
img
似乎没有关闭
您是否尝试将结果包装在
IPython.display.HTML
中?是的,我尝试了:HTML(df.to_HTML(escape=True))。没有更改。我已更新了原始代码。