MCPcopy
hub / github.com/pandas-dev/pandas / reset_option

Function reset_option

pandas/_config/config.py:344–398  ·  view source on GitHub ↗

Reset one or more options to their default value. This method resets the specified pandas option(s) back to their default values. It allows partial string matching for convenience, but users should exercise caution to avoid unintended resets due to changes in option names in fu

(pat: str)

Source from the content-addressed store, hash-verified

342
343
344def reset_option(pat: str) -> None:
345 """
346 Reset one or more options to their default value.
347
348 This method resets the specified pandas option(s) back to their default
349 values. It allows partial string matching for convenience, but users should
350 exercise caution to avoid unintended resets due to changes in option names
351 in future versions.
352
353 Parameters
354 ----------
355 pat : str/regex
356 If specified only options matching ``pat*`` will be reset.
357 Pass ``"all"`` as argument to reset all options.
358
359 .. warning::
360
361 Partial matches are supported for convenience, but unless you
362 use the full option name (e.g. x.y.z.option_name), your code may break
363 in future versions if new options with similar names are introduced.
364
365 Returns
366 -------
367 None
368 No return value.
369
370 See Also
371 --------
372 get_option : Retrieve the value of the specified option.
373 set_option : Set the value of the specified option or options.
374 describe_option : Print the description for one or more registered options.
375
376 Notes
377 -----
378 For all available options, please view the
379 :ref:`User Guide <options.available>`.
380
381 Examples
382 --------
383 >>> pd.reset_option("display.max_columns") # doctest: +SKIP
384 """
385 keys = _select_options(pat)
386
387 if len(keys) == 0:
388 raise OptionError(f"No such keys(s) for {pat=}")
389
390 if len(keys) > 1 and len(pat) < 4 and pat != "all":
391 raise ValueError(
392 "You must specify at least 4 characters when "
393 "resetting multiple keys, use the special keyword "
394 '"all" to reset all the options to their default value'
395 )
396
397 for k in keys:
398 set_option(k, _registered_options[k].defval)
399
400
401def get_default_val(pat: str):

Callers 2

reset_float_formatFunction · 0.90

Calls 3

_select_optionsFunction · 0.85
OptionErrorClass · 0.85
set_optionFunction · 0.85

Tested by 2

reset_float_formatFunction · 0.72