Jupyter pandas.DataFrame 输出表格式配置 [英] Jupyter pandas.DataFrame output table format configuration
问题描述
在哪里可以配置 Jupyter 使 DataFrame 对象默认显示为全边框表?
Where can I configure Jupyter to make a DataFrame object appear as a full-bordered table by default?
现在看起来像这样:
我希望它看起来像:
推荐答案
您可以将以下代码添加到您的笔记本中,该代码将应用于当前笔记本中的所有单元格,无论它在哪个单元格中输入:
You can add the following code to your notebook, which will apply to all cells in the current notebook regardless of what cell it's entered in:
%%HTML
<style type="text/css">
table.dataframe td, table.dataframe th {
border-style: solid;
}
</style>
如果你希望它适用于所有笔记本,你可以添加一个自定义的 config/css 文件.可以找到有关如何做到这一点的答案 此处.
If you want it to apply to all notebooks, you can add a custom config/css file. Answers on how to do that can be found here.
您可能还想探索 jupyterthemes,具体取决于您想要进行多少其他配置.
You might also want to explore jupyterthemes depending on how much other configuration you want to do.
这篇关于Jupyter pandas.DataFrame 输出表格式配置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!