Skip to content

Commit 5e024c1

Browse files
jordan-d-murphypmhatre1
authored andcommitted
DOC: fix EX03 errors in docstrings - pandas.errors: SettingWithCopyWarning, SpecificationError, UndefinedVariableError (pandas-dev#56989)
1 parent fdce84f commit 5e024c1

File tree

2 files changed

+7
-10
lines changed

2 files changed

+7
-10
lines changed

ci/code_checks.sh

-3
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
7373
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX03 --ignore_functions \
7474
pandas.Series.plot.line \
7575
pandas.Series.to_sql \
76-
pandas.errors.SettingWithCopyWarning \
77-
pandas.errors.SpecificationError \
78-
pandas.errors.UndefinedVariableError \
7976
pandas.read_json \
8077
pandas.DataFrame.to_sql \
8178
RET=$(($RET + $?)) ; echo $MSG "DONE"

pandas/errors/__init__.py

+7-7
Original file line numberDiff line numberDiff line change
@@ -397,13 +397,13 @@ class SpecificationError(Exception):
397397
>>> df = pd.DataFrame({'A': [1, 1, 1, 2, 2],
398398
... 'B': range(5),
399399
... 'C': range(5)})
400-
>>> df.groupby('A').B.agg({'foo': 'count'}) # doctest: +SKIP
400+
>>> df.groupby('A').B.agg({'foo': 'count'}) # doctest: +SKIP
401401
... # SpecificationError: nested renamer is not supported
402402
403-
>>> df.groupby('A').agg({'B': {'foo': ['sum', 'max']}}) # doctest: +SKIP
403+
>>> df.groupby('A').agg({'B': {'foo': ['sum', 'max']}}) # doctest: +SKIP
404404
... # SpecificationError: nested renamer is not supported
405405
406-
>>> df.groupby('A').agg(['min', 'min']) # doctest: +SKIP
406+
>>> df.groupby('A').agg(['min', 'min']) # doctest: +SKIP
407407
... # SpecificationError: nested renamer is not supported
408408
"""
409409

@@ -447,7 +447,7 @@ class SettingWithCopyWarning(Warning):
447447
Examples
448448
--------
449449
>>> df = pd.DataFrame({'A': [1, 1, 1, 2, 2]}, columns=['A'])
450-
>>> df.loc[0:3]['A'] = 'a' # doctest: +SKIP
450+
>>> df.loc[0:3]['A'] = 'a' # doctest: +SKIP
451451
... # SettingWithCopyWarning: A value is trying to be set on a copy of a...
452452
"""
453453

@@ -578,11 +578,11 @@ class UndefinedVariableError(NameError):
578578
Examples
579579
--------
580580
>>> df = pd.DataFrame({'A': [1, 1, 1]})
581-
>>> df.query("A > x") # doctest: +SKIP
581+
>>> df.query("A > x") # doctest: +SKIP
582582
... # UndefinedVariableError: name 'x' is not defined
583-
>>> df.query("A > @y") # doctest: +SKIP
583+
>>> df.query("A > @y") # doctest: +SKIP
584584
... # UndefinedVariableError: local variable 'y' is not defined
585-
>>> pd.eval('x + 1') # doctest: +SKIP
585+
>>> pd.eval('x + 1') # doctest: +SKIP
586586
... # UndefinedVariableError: name 'x' is not defined
587587
"""
588588

0 commit comments

Comments
 (0)