Skip to content

Commit df5f257

Browse files
authored
DOC: Fixing EX01 - Added examples (#53946)
Examples options
1 parent 5949333 commit df5f257

File tree

2 files changed

+26
-4
lines changed

2 files changed

+26
-4
lines changed

ci/code_checks.sh

-4
Original file line numberDiff line numberDiff line change
@@ -118,10 +118,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
118118
pandas.io.stata.StataReader.value_labels \
119119
pandas.io.stata.StataReader.variable_labels \
120120
pandas.io.stata.StataWriter.write_file \
121-
pandas.describe_option \
122-
pandas.reset_option \
123-
pandas.get_option \
124-
pandas.set_option \
125121
pandas.plotting.deregister_matplotlib_converters \
126122
pandas.plotting.plot_params \
127123
pandas.plotting.register_matplotlib_converters \

pandas/_config/config.py

+26
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,11 @@ def __doc__(self) -> str: # type: ignore[override]
300300
The available options with its descriptions:
301301
302302
{opts_desc}
303+
304+
Examples
305+
--------
306+
>>> pd.get_option('display.max_columns') # doctest: +SKIP
307+
4
303308
"""
304309

305310
_set_option_tmpl = """
@@ -336,6 +341,17 @@ def __doc__(self) -> str: # type: ignore[override]
336341
The available options with its descriptions:
337342
338343
{opts_desc}
344+
345+
Examples
346+
--------
347+
>>> pd.set_option('display.max_columns', 4)
348+
>>> df = pd.DataFrame([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
349+
>>> df
350+
0 1 ... 3 4
351+
0 1 2 ... 4 5
352+
1 6 7 ... 9 10
353+
[2 rows x 5 columns]
354+
>>> pd.reset_option('display.max_columns')
339355
"""
340356

341357
_describe_option_tmpl = """
@@ -370,6 +386,12 @@ def __doc__(self) -> str: # type: ignore[override]
370386
The available options with its descriptions:
371387
372388
{opts_desc}
389+
390+
Examples
391+
--------
392+
>>> pd.describe_option('display.max_columns') # doctest: +SKIP
393+
display.max_columns : int
394+
If max_cols is exceeded, switch to truncate view...
373395
"""
374396

375397
_reset_option_tmpl = """
@@ -402,6 +424,10 @@ def __doc__(self) -> str: # type: ignore[override]
402424
The available options with its descriptions:
403425
404426
{opts_desc}
427+
428+
Examples
429+
--------
430+
>>> pd.reset_option('display.max_columns') # doctest: +SKIP
405431
"""
406432

407433
# bind the functions with their docstrings into a Callable

0 commit comments

Comments
 (0)