pandas设置打印宽度

当未设置打印宽度时,如果有个列存在字符串较长的情况,有可能打印显示为...,如下:

python-pandas设置打印宽度

设置打印宽度:

import pandas as pd

pd.set_option('display.max_colwidth', 20)

可以显示完全:
python-pandas设置打印宽度

pandas一些打印设置

python-pandas设置打印宽度

使用如下:

pd.get_option('display.width')
pd.set_option('display.width', 180)  # 150,设置打印宽度
​
pd.set_option('display.max_rows', None) # 打印最大行数
pd.set_option('display.max_columns', 40) # 打印最大列数

相关文章:

  • 2022-12-23
  • 2021-12-15
  • 2022-01-20
  • 2021-10-10
  • 2021-11-08
  • 2021-06-11
  • 2021-12-27
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2021-04-20
  • 2022-12-23
  • 2021-08-17
相关资源
相似解决方案