1. import pandas as ps
    2. pd.set_option(‘expand_frame_repr‘, True)
    3. # True就是可以换行显示。设置成False的时候不允许换行
    4. pd.set_option(‘display.max_rows‘, 10)
    5. pd.set_option(‘display.max_rows‘, None) # 显示所有行
    6. pd.set_option(‘display.max_columns‘, 10)
    7. pd.set_option(‘display.max_columns‘, None) # 显示所有列
    8. # 显示的最大行数和列数,如果超额就显示省略号,这个指的是多少个dataFrame的列。
    9. # 如果比较多又不允许换行,就会显得很乱。
    10. pd.set_option(‘precision‘, 5)
    11. # 显示小数点后的位数
    12. pd.set_option(‘large_repr‘, A)
    13. # truncate表示截断,info表示查看信息,一般选truncate
    14. pd.set_option(‘max_colwidth‘, 5)
    15. # 用于设置列中单独元素的最大长度,默认为50
    16. pd.set_option(‘chop_threshold‘, 0.5)
    17. # 绝对值小于0.5的显示0.0
    18. pd.set_option(‘colheader_justify‘, left‘)
    19. # 显示居中还是左边,
    20. pd.set_option(‘display.width‘, 200)
    21. # 横向最多显示多少个字符, 一般80不适合横向的屏幕,平时多用200.
    22. pd.set_option(‘max_colwidth‘, 10000)
    23. df = pd.DataFrame({ a‘:[[6]*1000,5,3,5,6,7],
    24. b‘:[4]*6,
    25. c‘:[5]*6,
    26. v‘:[7]*6})
    27. print(df)

    pd.set_option - 图1

    pd.set_option - 图2