如何在 Pandas & 中创建带有可点击超链接的表格Jupyter 笔记本 [英] How to create a table with clickable hyperlink in pandas & Jupyter Notebook
本文介绍了如何在 Pandas & 中创建带有可点击超链接的表格Jupyter 笔记本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
print('http://google.com')
输出一个可点击的网址.
print('http://google.com')
outputs a clickable url.
如何获取 pd.DataFrame(['http://google.com', 'http://duckduckgo.com'])
的可点击网址?
How do I get clickable URLs for pd.DataFrame(['http://google.com', 'http://duckduckgo.com'])
?
推荐答案
尝试使用 pd.DataFrame.style.format
为此:
Try using pd.DataFrame.style.format
for this:
df = pd.DataFrame(['http://google.com', 'http://duckduckgo.com'])
def make_clickable(val):
return '<a href="{}">{}</a>'.format(val,val)
df.style.format(make_clickable)
我希望这证明有用.
这篇关于如何在 Pandas & 中创建带有可点击超链接的表格Jupyter 笔记本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文