diff --git a/doc/source/reference/general_utility_functions.rst b/doc/source/reference/general_utility_functions.rst index 6d43ceb74ab7c..993107dc09756 100644 --- a/doc/source/reference/general_utility_functions.rst +++ b/doc/source/reference/general_utility_functions.rst @@ -40,6 +40,7 @@ Exceptions and warnings errors.EmptyDataError errors.OutOfBoundsDatetime errors.MergeError + errors.NullFrequencyError errors.NumbaUtilError errors.ParserError errors.ParserWarning diff --git a/pandas/_libs/tslibs/__init__.py b/pandas/_libs/tslibs/__init__.py index d7bc77baa5e05..370b49f2c4fa3 100644 --- a/pandas/_libs/tslibs/__init__.py +++ b/pandas/_libs/tslibs/__init__.py @@ -13,7 +13,6 @@ "ints_to_pytimedelta", "Timestamp", "tz_convert_single", - "NullFrequencyError", ] @@ -22,5 +21,5 @@ from .np_datetime import OutOfBoundsDatetime from .period import IncompatibleFrequency, Period from .timedeltas import Timedelta, delta_to_nanoseconds, ints_to_pytimedelta -from .timestamps import NullFrequencyError, Timestamp +from .timestamps import Timestamp from .tzconversion import tz_convert_single diff --git a/pandas/_libs/tslibs/timestamps.pyx b/pandas/_libs/tslibs/timestamps.pyx index af98057378d7b..ab8f9b6c30eb1 100644 --- a/pandas/_libs/tslibs/timestamps.pyx +++ b/pandas/_libs/tslibs/timestamps.pyx @@ -183,15 +183,6 @@ def round_nsint64(values, mode, freq): # ---------------------------------------------------------------------- -class NullFrequencyError(ValueError): - """ - Error raised when a null `freq` attribute is used in an operation - that needs a non-null frequency, particularly `DatetimeIndex.shift`, - `TimedeltaIndex.shift`, `PeriodIndex.shift`. - """ - pass - - def integer_op_not_supported(obj): # GH#22535 add/sub of integers and int-arrays is no longer allowed # Note we return rather than raise the exception so we can raise in diff --git a/pandas/errors/__init__.py b/pandas/errors/__init__.py index ef841d2dd4918..4c4ce9df85543 100644 --- a/pandas/errors/__init__.py +++ b/pandas/errors/__init__.py @@ -6,7 +6,17 @@ from pandas._config.config import OptionError -from pandas._libs.tslibs import NullFrequencyError, OutOfBoundsDatetime +from pandas._libs.tslibs import OutOfBoundsDatetime + + +class NullFrequencyError(ValueError): + """ + Error raised when a null `freq` attribute is used in an operation + that needs a non-null frequency, particularly `DatetimeIndex.shift`, + `TimedeltaIndex.shift`, `PeriodIndex.shift`. + """ + + pass class PerformanceWarning(Warning): diff --git a/pandas/tests/tslibs/test_api.py b/pandas/tests/tslibs/test_api.py index ce50b6729ec34..5518760dbacb3 100644 --- a/pandas/tests/tslibs/test_api.py +++ b/pandas/tests/tslibs/test_api.py @@ -30,7 +30,6 @@ def test_namespace(): "iNaT", "is_null_datetimelike", "nat_strings", - "NullFrequencyError", "OutOfBoundsDatetime", "Period", "IncompatibleFrequency",