Skip to content

Commit 71bcd00

Browse files
tiffanyxiaopmhatre1
authored andcommitted
DOC: fixed Ex03 errors in docstrings: (pandas-dev#56878)
* Addressing docstring errors * Resolving merge conflicts * Removing extra formatting in See Also
1 parent 727f6a4 commit 71bcd00

File tree

2 files changed

+29
-11
lines changed

2 files changed

+29
-11
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.DatabaseError \
77-
pandas.errors.IndexingError \
78-
pandas.errors.InvalidColumnName \
7976
pandas.errors.SettingWithCopyWarning \
8077
pandas.errors.SpecificationError \
8178
pandas.errors.UndefinedVariableError \

pandas/errors/__init__.py

+29-8
Original file line numberDiff line numberDiff line change
@@ -599,19 +599,30 @@ class IndexingError(Exception):
599599
"""
600600
Exception is raised when trying to index and there is a mismatch in dimensions.
601601
602+
Raised by properties like :attr:`.pandas.DataFrame.iloc` when
603+
an indexer is out of bounds or :attr:`.pandas.DataFrame.loc` when its index is
604+
unalignable to the frame index.
605+
606+
See Also
607+
--------
608+
DataFrame.iloc : Purely integer-location based indexing for \
609+
selection by position.
610+
DataFrame.loc : Access a group of rows and columns by label(s) \
611+
or a boolean array.
612+
602613
Examples
603614
--------
604615
>>> df = pd.DataFrame({'A': [1, 1, 1]})
605-
>>> df.loc[..., ..., 'A'] # doctest: +SKIP
616+
>>> df.loc[..., ..., 'A'] # doctest: +SKIP
606617
... # IndexingError: indexer may only contain one '...' entry
607618
>>> df = pd.DataFrame({'A': [1, 1, 1]})
608-
>>> df.loc[1, ..., ...] # doctest: +SKIP
619+
>>> df.loc[1, ..., ...] # doctest: +SKIP
609620
... # IndexingError: Too many indexers
610-
>>> df[pd.Series([True], dtype=bool)] # doctest: +SKIP
621+
>>> df[pd.Series([True], dtype=bool)] # doctest: +SKIP
611622
... # IndexingError: Unalignable boolean Series provided as indexer...
612623
>>> s = pd.Series(range(2),
613-
... index = pd.MultiIndex.from_product([["a", "b"], ["c"]]))
614-
>>> s.loc["a", "c", "d"] # doctest: +SKIP
624+
... index=pd.MultiIndex.from_product([["a", "b"], ["c"]]))
625+
>>> s.loc["a", "c", "d"] # doctest: +SKIP
615626
... # IndexingError: Too many indexers
616627
"""
617628

@@ -713,13 +724,19 @@ class AttributeConflictWarning(Warning):
713724

714725
class DatabaseError(OSError):
715726
"""
716-
Error is raised when executing sql with bad syntax or sql that throws an error.
727+
Error is raised when executing SQL with bad syntax or SQL that throws an error.
728+
729+
Raised by :func:`.pandas.read_sql` when a bad SQL statement is passed in.
730+
731+
See Also
732+
--------
733+
read_sql : Read SQL query or database table into a DataFrame.
717734
718735
Examples
719736
--------
720737
>>> from sqlite3 import connect
721738
>>> conn = connect(':memory:')
722-
>>> pd.read_sql('select * test', conn) # doctest: +SKIP
739+
>>> pd.read_sql('select * test', conn) # doctest: +SKIP
723740
... # DatabaseError: Execution failed on sql 'test': near "test": syntax error
724741
"""
725742

@@ -758,10 +775,14 @@ class InvalidColumnName(Warning):
758775
Because the column name is an invalid Stata variable, the name needs to be
759776
converted.
760777
778+
See Also
779+
--------
780+
DataFrame.to_stata : Export DataFrame object to Stata dta format.
781+
761782
Examples
762783
--------
763784
>>> df = pd.DataFrame({"0categories": pd.Series([2, 2])})
764-
>>> df.to_stata('test') # doctest: +SKIP
785+
>>> df.to_stata('test') # doctest: +SKIP
765786
... # InvalidColumnName: Not all pandas column names were valid Stata variable...
766787
"""
767788

0 commit comments

Comments
 (0)