Getting wider output in PyCharm's built-in console
It appears I was mistaken in thinking that the issue was one in PyCharm (that could be solved, for example, in a setting or preference.) It actually has to do with the console session itself. The console attempts to auto-detect the width of the display area, but when that fails it defaults to 80 characters. This behavior can be overridden with:
import pandas as pd
desired_width = 320
pd.set_option('display.width', desired_width)
Where you can of course set the desired_width
to whatever your display will tolerate.
Thanks to @TidB for the suggestion that my initial concern wasn't focused in the right area.
For me, just setting 'display.width'
wasn't enough in pycharm, it kept displaying in truncated form.
However, adding the option pd.set_option("display.max_columns", 10)
together with display width worked and I was able to see the whole dataframe printed in the "run" output.
In summary:
import pandas as pd
pd.set_option('display.width', 400)
pd.set_option('display.max_columns', 10)
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.