Print the description for one or more registered options. Call with no arguments to get a listing for all registered options. Parameters ---------- pat : str, default "" String or string regexp pattern. Empty string will return all options. For regexp s
(pat: str = "", _print_desc: bool = True)
| 289 | |
| 290 | |
| 291 | def describe_option(pat: str = "", _print_desc: bool = True) -> str | None: |
| 292 | """ |
| 293 | Print the description for one or more registered options. |
| 294 | |
| 295 | Call with no arguments to get a listing for all registered options. |
| 296 | |
| 297 | Parameters |
| 298 | ---------- |
| 299 | pat : str, default "" |
| 300 | String or string regexp pattern. |
| 301 | Empty string will return all options. |
| 302 | For regexp strings, all matching keys will have their description displayed. |
| 303 | _print_desc : bool, default True |
| 304 | If True (default) the description(s) will be printed to stdout. |
| 305 | Otherwise, the description(s) will be returned as a string |
| 306 | (for testing). |
| 307 | |
| 308 | Returns |
| 309 | ------- |
| 310 | None |
| 311 | If ``_print_desc=True``. |
| 312 | str |
| 313 | If the description(s) as a string if ``_print_desc=False``. |
| 314 | |
| 315 | See Also |
| 316 | -------- |
| 317 | get_option : Retrieve the value of the specified option. |
| 318 | set_option : Set the value of the specified option or options. |
| 319 | reset_option : Reset one or more options to their default value. |
| 320 | |
| 321 | Notes |
| 322 | ----- |
| 323 | For all available options, please view the |
| 324 | :ref:`User Guide <options.available>`. |
| 325 | |
| 326 | Examples |
| 327 | -------- |
| 328 | >>> pd.describe_option("display.max_columns") # doctest: +SKIP |
| 329 | display.max_columns : int |
| 330 | If max_cols is exceeded, switch to truncate view... |
| 331 | """ |
| 332 | keys = _select_options(pat) |
| 333 | if len(keys) == 0: |
| 334 | raise OptionError(f"No such keys(s) for {pat=}") |
| 335 | |
| 336 | s = "\n".join([_build_option_description(k) for k in keys]) |
| 337 | |
| 338 | if _print_desc: |
| 339 | print(s) |
| 340 | return None |
| 341 | return s |
| 342 | |
| 343 | |
| 344 | def reset_option(pat: str) -> None: |
nothing calls this directly
no test coverage detected