pandas.option_context

classpandas.option_context(*args)[source]

Context manager to temporarily set options in the with statement context.

You need to invoke as option_context(pat, val, [(pat, val), ...]).

Examples

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

Methods

© 2008–2011, AQR Capital Management, LLC, Lambda Foundry, Inc. and PyData Development Team
© 2011–2025, Open source contributors
Licensed under the 3-clause BSD License.
https://pandas.pydata.org/pandas-docs/version/2.3.0/reference/api/pandas.option_context.html