Restore default display context in Pandas

I ended up in cases where I accidentally run:

pd.option_context('display.max_columns', None, 
                  'display.max_rows', None, 
                  'display.width', None, 
                  'display.max_colwidth', 0)

no suggestion with. Unfortunately, this changes the default print settings for all of my operators print.

My question is: how to restore to default context?

A call pd.option_context()without arguments does not work, I get:

ValueError: Need to invoke asoption_context(pat, val, [(pat, val), ...)).
+4
source share
1 answer

You can use pd.reset_optionto reset one parameter or you can use a regular expression to reset more than once at a time. In your case, to reset all parameters starting with display, you can do:

pd.reset_option('^display.', silent=True)
+7
source

All Articles