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 runtim
(*args)
| 192 | |
| 193 | |
| 194 | def set_option(*args) -> None: |
| 195 | """ |
| 196 | Set the value of the specified option or options. |
| 197 | |
| 198 | This method allows fine-grained control over the behavior and display settings |
| 199 | of pandas. Options affect various functionalities such as output formatting, |
| 200 | display limits, and operational behavior. Settings can be modified at runtime |
| 201 | without requiring changes to global configurations or environment variables. |
| 202 | |
| 203 | Parameters |
| 204 | ---------- |
| 205 | *args : str | object | dict |
| 206 | Arguments provided in pairs, which will be interpreted as (pattern, value), |
| 207 | or as a single dictionary containing multiple option-value pairs. |
| 208 | pattern: str |
| 209 | Regexp which should match a single option |
| 210 | value: object |
| 211 | New value of option |
| 212 | |
| 213 | .. warning:: |
| 214 | |
| 215 | Partial pattern matches are supported for convenience, but unless you |
| 216 | use the full option name (e.g. x.y.z.option_name), your code may break in |
| 217 | future versions if new options with similar names are introduced. |
| 218 | |
| 219 | Returns |
| 220 | ------- |
| 221 | None |
| 222 | No return value. |
| 223 | |
| 224 | Raises |
| 225 | ------ |
| 226 | ValueError if odd numbers of non-keyword arguments are provided |
| 227 | TypeError if keyword arguments are provided |
| 228 | OptionError if no such option exists |
| 229 | |
| 230 | See Also |
| 231 | -------- |
| 232 | get_option : Retrieve the value of the specified option. |
| 233 | reset_option : Reset one or more options to their default value. |
| 234 | describe_option : Print the description for one or more registered options. |
| 235 | option_context : Context manager to temporarily set options in a ``with`` |
| 236 | statement. |
| 237 | |
| 238 | Notes |
| 239 | ----- |
| 240 | For all available options, please view the :ref:`User Guide <options.available>` |
| 241 | or use ``pandas.describe_option()``. |
| 242 | |
| 243 | Examples |
| 244 | -------- |
| 245 | Option-Value Pair Input: |
| 246 | |
| 247 | >>> pd.set_option("display.max_columns", 4) |
| 248 | >>> df = pd.DataFrame([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]]) |
| 249 | >>> df |
| 250 | 0 1 ... 3 4 |
| 251 | 0 1 2 ... 4 5 |
no test coverage detected