Jupyter pandas.DataFrame 输出表格式配置 [英] Jupyter pandas.DataFrame output table format configuration

查看:47
本文介绍了Jupyter pandas.DataFrame 输出表格式配置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在哪里可以配置 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆