Skip to content

DOC: fix EX03 errors in docstrings - pandas.errors: SettingWithCopyWarning, SpecificationError, UndefinedVariableError #56989

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions ci/code_checks.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then
$BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX03 --ignore_functions \
pandas.Series.plot.line \
pandas.Series.to_sql \
pandas.errors.SettingWithCopyWarning \
pandas.errors.SpecificationError \
pandas.errors.UndefinedVariableError \
pandas.read_json \
pandas.DataFrame.to_sql \
RET=$(($RET + $?)) ; echo $MSG "DONE"
Expand Down
14 changes: 7 additions & 7 deletions pandas/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,13 +397,13 @@ class SpecificationError(Exception):
>>> df = pd.DataFrame({'A': [1, 1, 1, 2, 2],
... 'B': range(5),
... 'C': range(5)})
>>> df.groupby('A').B.agg({'foo': 'count'}) # doctest: +SKIP
>>> df.groupby('A').B.agg({'foo': 'count'}) # doctest: +SKIP
... # SpecificationError: nested renamer is not supported

>>> df.groupby('A').agg({'B': {'foo': ['sum', 'max']}}) # doctest: +SKIP
>>> df.groupby('A').agg({'B': {'foo': ['sum', 'max']}}) # doctest: +SKIP
... # SpecificationError: nested renamer is not supported

>>> df.groupby('A').agg(['min', 'min']) # doctest: +SKIP
>>> df.groupby('A').agg(['min', 'min']) # doctest: +SKIP
... # SpecificationError: nested renamer is not supported
"""

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

Expand Down Expand Up @@ -578,11 +578,11 @@ class UndefinedVariableError(NameError):
Examples
--------
>>> df = pd.DataFrame({'A': [1, 1, 1]})
>>> df.query("A > x") # doctest: +SKIP
>>> df.query("A > x") # doctest: +SKIP
... # UndefinedVariableError: name 'x' is not defined
>>> df.query("A > @y") # doctest: +SKIP
>>> df.query("A > @y") # doctest: +SKIP
... # UndefinedVariableError: local variable 'y' is not defined
>>> pd.eval('x + 1') # doctest: +SKIP
>>> pd.eval('x + 1') # doctest: +SKIP
... # UndefinedVariableError: name 'x' is not defined
"""

Expand Down