Jupyter notebook 输出部分显示不全的解决方案

在我更换了jupyter主题后,输出部分总是显示不全,差两个字符;Github上已经有人提出了这个问题,并有了解决方案,亲测有效。

在这个路径,打开custom文件夹

在这里插入图片描述

打开custom.css文件:

replace the current div.output_area with the following in the custom css file:

div.output_area {display: -webkit-box;padding: 13px;}

在这里插入图片描述

这个13px,可能有的人改了以后,还是显示不全,可以多试几个数,因为有的人浏览器显示比例不一样

重新运行jupyter notebook,输出部分显示不全的问题解决。

补充:jupyter中关于pandas的dataframe行列显示不全与复原

在jupyternote book中,当dataframe数据的列数或行数很多时,默认为了减少显示的面积会只能显示其中部分列或行的数据。本文记录如何将数据显示完全和如何复原默认操作。

问题: 列或行显示不全

如:列显示不全

解决方式:

pd.set_option('display.max_columns', None)
#显示所有列pd.set_option('display.max_columns', None) #原来中间会有部分列的显示被省略data.describe()

还原默认配置:reset_option

pd.reset_option("display.max_columns") # 还原默认的显示方式

对于行显示不全的解决类似,将display.max_columns改为display_maxrows即可。

也可以指定设置显示的行数。

如: display.max_rows = 60

相关参数配置:

编号 参数 描述
1 display.max_rows 要显示的最大行数
2 display.max_columns 要显示的最大列数
3 display.expand_frame_repr 显示数据帧以拉伸页面
4 display.max_colwidth 显示最大列宽
5 display.precision 显示十进制数的精度

以上为个人经验,希望能给大家一个参考,也希望大家多多支持 。如有错误或未考虑完全的地方,望不吝赐教。

相关文章

发表新评论