pandas
dataframe
的输出是HTML table
,我想知道它是如何将html生成Ipython Notebook
?在
<div class="output_subarea output_html rendered_html output_result">
<div>
<table class="dataframe" border="1">
<thead>
<tr style="text-align: right">
因为我还想用一些html来包装我的输出,所以我想知道如何包装。 (Ipython Notebook & Matplotlib: How to wrap a plot within a html div?)
我现在正在挖掘源代码:https://github.com/pydata/pandas/blob/2d51b33066e5991913dcba2cfb93d2112a2e8a8f/pandas/core/format.py
在IPython中,您可以通过导入IPython的显示模块来显示任意HTML。Pandas可以将
DataFrame
转换为html,然后您可以将您的更新应用到其中,例如:应该显示与上面相同的html表。在
^{pr2}$DataFrame.to_html()
返回一个http字符串,因此您可以进行简单的字符串操作来包装文本:会把桌子藏起来。在
相关问题 更多 >
编程相关推荐