Getting wider output in PyCharm's built-in console

前端 未结 4 2166
情歌与酒
情歌与酒 2021-01-30 06:54

I\'m relatively new to using the PyCharm IDE, and have been unable to find a way to better shape the output when in a built-in console session. I\'m typically working with prett

4条回答
  •  甜味超标
    2021-01-30 06:57

    The answer by @mattvivier works nicely when printing Pandas dataframes (thanks!).

    However, if you are printing NumPy arrays, you need to set np.set_printoptions as well:

    import pandas as pd
    import numpy as np
    desired_width = 320
    pd.set_option('display.width', desired_width)
    np.set_printoptions(linewidth=desired_width)
    

    See docs on NumPy and set_printoptions.

提交回复
热议问题