pandas.option_context#

pandas.option_context(*args)[source]#

Context manager to temporarily set options in a with statement.

Parameters:
*argsstr | object

An even amount of arguments provided in pairs which will be interpreted as (pattern, value) pairs.

Returns:
None

No return value.

See also

get_option

Retrieve the value of the specified option.

set_option

Set the value of the specified option.

reset_option

Reset one or more options to their default value.

describe_option

Print the description for one or more registered options.

Notes

For all available options, please view the User Guide or use pandas.describe_option().

Examples

>>> from pandas import option_context
>>> with option_context("display.max_rows", 10, "display.max_columns", 5):
...     pass