【发布时间】:2014-09-24 02:21:14
【问题描述】:
我在 Pandas 数据框(下表)的一列中嵌入链接并将数据框写入 hmtl。
数据框表中的链接格式如下所示(索引表中的第一个链接):
In: table.loc[0,'Links']
Out: u'<a href="http://xxx.xx.xxx.xxx/browser/I6.html">I6</a>'
如果我查看(而不是索引特定行)数据框(在笔记本中),链接文本将被截断:
<a href="http://xxx.xx.xxx.xxx/browser/I6.html...
我将数据框写入 html:
table_1=table.to_html(classes='table',index=False,escape=False)
但是,被截断的链接(而不是全文)被写入 html 表:
<td> <a href="http://xxx.xx.xxx.xxx/browser/I6.html...</td>\n
我可能需要一个额外的 to_html() 参数。
现在查看文档,但建议表示赞赏:
http://pandas.pydata.org/pandas-docs/dev/generated/pandas.DataFrame.to_html.html
谢谢!
【问题讨论】:
-
我已经向 pandas 提交了一个pull request 以使这种事情变得更容易。