diff --git a/ci/code_checks.sh b/ci/code_checks.sh index a0fb7ab6e411d..bb5bc200c6fa7 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -118,10 +118,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then pandas.io.stata.StataReader.value_labels \ pandas.io.stata.StataReader.variable_labels \ pandas.io.stata.StataWriter.write_file \ - pandas.describe_option \ - pandas.reset_option \ - pandas.get_option \ - pandas.set_option \ pandas.plotting.deregister_matplotlib_converters \ pandas.plotting.plot_params \ pandas.plotting.register_matplotlib_converters \ diff --git a/pandas/_config/config.py b/pandas/_config/config.py index 33e5ac8d2a26c..9caeaadc1ad84 100644 --- a/pandas/_config/config.py +++ b/pandas/_config/config.py @@ -300,6 +300,11 @@ def __doc__(self) -> str: # type: ignore[override] The available options with its descriptions: {opts_desc} + +Examples +-------- +>>> pd.get_option('display.max_columns') # doctest: +SKIP +4 """ _set_option_tmpl = """ @@ -336,6 +341,17 @@ def __doc__(self) -> str: # type: ignore[override] The available options with its descriptions: {opts_desc} + +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') """ _describe_option_tmpl = """ @@ -370,6 +386,12 @@ def __doc__(self) -> str: # type: ignore[override] The available options with its descriptions: {opts_desc} + +Examples +-------- +>>> pd.describe_option('display.max_columns') # doctest: +SKIP +display.max_columns : int + If max_cols is exceeded, switch to truncate view... """ _reset_option_tmpl = """ @@ -402,6 +424,10 @@ def __doc__(self) -> str: # type: ignore[override] The available options with its descriptions: {opts_desc} + +Examples +-------- +>>> pd.reset_option('display.max_columns') # doctest: +SKIP """ # bind the functions with their docstrings into a Callable