Python terminal output width Python terminal output width shell shell

Python terminal output width


For numpy, it turns out you can enable the full output by setting

np.set_printoptions(suppress=True,linewidth=np.nan,threshold=np.nan).


In Python 3.7 and above, you can use

from shutil import get_terminal_sizepd.set_option('display.width', get_terminal_size()[0])


I have the same problem while using pandas. So if this is what you are trying to solve, I fixed mine by doing pd.set_option('display.width', pd.util.terminal.get_terminal_size()[0])