pandas.set_option — pandas 3.0.0.dev0+2097.gcdc5b7418e documentation (original) (raw)
pandas.set_option(*args)[source]#
Set the value of the specified option or options.
This method allows fine-grained control over the behavior and display settings of pandas. Options affect various functionalities such as output formatting, display limits, and operational behavior. Settings can be modified at runtime without requiring changes to global configurations or environment variables.
Parameters:
*argsstr | object
Arguments provided in pairs, which will be interpreted as (pattern, value) pairs. pattern: str Regexp which should match a single option value: object New value of option
Warning
Partial pattern matches are supported for convenience, but unless you use the full option name (e.g. x.y.z.option_name), your code may break in future versions if new options with similar names are introduced.
Returns:
None
No return value.
Raises:
ValueError if odd numbers of non-keyword arguments are provided
TypeError if keyword arguments are provided
OptionError if no such option exists
See also
Retrieve the value of the specified option.
Reset one or more options to their default value.
Print the description for one or more registered options.
Context manager to temporarily set options in a with
statement.
Notes
For all available options, please view the User Guideor use pandas.describe_option()
.
Examples
pd.set_option("display.max_columns", 4) df = pd.DataFrame([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) df 0 1 ... 3 4 0 1 2 ... 4 5 1 6 7 ... 9 10 [2 rows x 5 columns] pd.reset_option("display.max_columns")