diff --git a/ci/code_checks.sh b/ci/code_checks.sh index 9123fd39c3b4f..1c6e23746352e 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -63,9 +63,6 @@ if [[ -z "$CHECK" || "$CHECK" == "docstrings" ]]; then MSG='Partially validate docstrings (EX01)' ; echo $MSG $BASE_DIR/scripts/validate_docstrings.py --format=actions --errors=EX01 --ignore_functions \ - pandas.errors.AccessorRegistrationWarning \ - pandas.errors.AttributeConflictWarning \ - pandas.errors.DataError \ pandas.errors.IncompatibilityWarning \ pandas.errors.InvalidComparison \ pandas.errors.IntCastingNaNError \ diff --git a/doc/source/reference/testing.rst b/doc/source/reference/testing.rst index edfafee430d1d..a5d61703aceed 100644 --- a/doc/source/reference/testing.rst +++ b/doc/source/reference/testing.rst @@ -25,7 +25,6 @@ Exceptions and warnings :toctree: api/ errors.AbstractMethodError - errors.AccessorRegistrationWarning errors.AttributeConflictWarning errors.CategoricalConversionWarning errors.ChainedAssignmentError diff --git a/pandas/errors/__init__.py b/pandas/errors/__init__.py index be6a9ef488be9..a4597551acc71 100644 --- a/pandas/errors/__init__.py +++ b/pandas/errors/__init__.py @@ -184,12 +184,6 @@ class MergeError(ValueError): """ -class AccessorRegistrationWarning(Warning): - """ - Warning for attribute conflicts in accessor registration. - """ - - class AbstractMethodError(NotImplementedError): """ Raise this error instead of NotImplementedError for abstract methods. @@ -281,6 +275,13 @@ class DataError(Exception): For example, calling ``ohlc`` on a non-numerical column or a function on a rolling window. + + Examples + -------- + >>> ser = pd.Series(['a', 'b', 'c']) + >>> ser.rolling(2).sum() + Traceback (most recent call last): + DataError: No numeric types to aggregate """ @@ -552,6 +553,17 @@ class AttributeConflictWarning(Warning): Occurs when attempting to append an index with a different name than the existing index on an HDFStore or attempting to append an index with a different frequency than the existing index on an HDFStore. + + Examples + -------- + >>> idx1 = pd.Index(['a', 'b'], name='name1') + >>> df1 = pd.DataFrame([[1, 2], [3, 4]], index=idx1) + >>> df1.to_hdf('file', 'data', 'w', append=True) # doctest: +SKIP + >>> idx2 = pd.Index(['c', 'd'], name='name2') + >>> df2 = pd.DataFrame([[5, 6], [7, 8]], index=idx2) + >>> df2.to_hdf('file', 'data', 'a', append=True) # doctest: +SKIP + AttributeConflictWarning: the [index_name] attribute of the existing index is + [name1] which conflicts with the new [name2]... """ @@ -644,7 +656,6 @@ class InvalidComparison(Exception): __all__ = [ "AbstractMethodError", - "AccessorRegistrationWarning", "AttributeConflictWarning", "CategoricalConversionWarning", "ClosedFileError",