I’m trying to configure my IPython output in my OS X terminal, but it would seem that none of the changes I’m trying to set are taking effect. I’m trying to configure the display settings such that wider outputs like a big DataFrame
will output without any truncation or as the summary info.
After importing pandas into my script, I have a few options set where I tried a whole bunch, but any one (or all, for that matter) does not seem to take effect. I’m running the script from IPython using %run
. Am I doing something wrong here?
import pandas as pd pd.set_option('display.expand_max_repr', False) pd.set_option('display.max_columns', 30) pd.set_option('display.width', None) pd.set_option('display.line_width', 200)
I’ve looked at some threads on Stack and the pandas FAQ to no avail, even when using these under the display namespace (or without), as I’ve attempted here.
I understand that there are some ways around this, such as calling to_string()
or describe()
methods on your output, but these are very manual, and don’t always work as intended in some cases, like one where I have calling to_string()
on a groupby
object yields:
id type 106125 puzzle gameplay_id sitting_id user_id ... 106253 frames gameplay_id sitting_id user_id ... 106260 trivia gameplay_id sitting_id user_id ...
My terminal window size is more than sufficient to accommodate the width, and calling pd.util.terminal.get_terminal_size()
is correctly finding the window size tuple, so it would seem that auto detecting the size isn’t working either. Any insight would be appreciated!
Advertisement
Answer
Just for completeness (I’ll add my comment as an answer), you missed out:
pd.options.display.max_colwidth # default is 50
this restricted the maximum length of a single column.
There are quite a few options to configure here, if you’re using ipython then tab complete to find the full set of display options:
pd.options.display.<tab>