Skip to content

Commit ee1efb6

Browse files
authored
REF: Implement NullFrequencyError in pd.errors (pandas-dev#34144)
1 parent 9c08fe1 commit ee1efb6

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

doc/source/reference/general_utility_functions.rst

+1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Exceptions and warnings
4040
errors.EmptyDataError
4141
errors.OutOfBoundsDatetime
4242
errors.MergeError
43+
errors.NullFrequencyError
4344
errors.NumbaUtilError
4445
errors.ParserError
4546
errors.ParserWarning

pandas/_libs/tslibs/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"ints_to_pytimedelta",
1414
"Timestamp",
1515
"tz_convert_single",
16-
"NullFrequencyError",
1716
]
1817

1918

@@ -22,5 +21,5 @@
2221
from .np_datetime import OutOfBoundsDatetime
2322
from .period import IncompatibleFrequency, Period
2423
from .timedeltas import Timedelta, delta_to_nanoseconds, ints_to_pytimedelta
25-
from .timestamps import NullFrequencyError, Timestamp
24+
from .timestamps import Timestamp
2625
from .tzconversion import tz_convert_single

pandas/_libs/tslibs/timestamps.pyx

-9
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,6 @@ def round_nsint64(values, mode, freq):
183183

184184
# ----------------------------------------------------------------------
185185

186-
class NullFrequencyError(ValueError):
187-
"""
188-
Error raised when a null `freq` attribute is used in an operation
189-
that needs a non-null frequency, particularly `DatetimeIndex.shift`,
190-
`TimedeltaIndex.shift`, `PeriodIndex.shift`.
191-
"""
192-
pass
193-
194-
195186
def integer_op_not_supported(obj):
196187
# GH#22535 add/sub of integers and int-arrays is no longer allowed
197188
# Note we return rather than raise the exception so we can raise in

pandas/errors/__init__.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@
66

77
from pandas._config.config import OptionError
88

9-
from pandas._libs.tslibs import NullFrequencyError, OutOfBoundsDatetime
9+
from pandas._libs.tslibs import OutOfBoundsDatetime
10+
11+
12+
class NullFrequencyError(ValueError):
13+
"""
14+
Error raised when a null `freq` attribute is used in an operation
15+
that needs a non-null frequency, particularly `DatetimeIndex.shift`,
16+
`TimedeltaIndex.shift`, `PeriodIndex.shift`.
17+
"""
18+
19+
pass
1020

1121

1222
class PerformanceWarning(Warning):

pandas/tests/tslibs/test_api.py

-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ def test_namespace():
3030
"iNaT",
3131
"is_null_datetimelike",
3232
"nat_strings",
33-
"NullFrequencyError",
3433
"OutOfBoundsDatetime",
3534
"Period",
3635
"IncompatibleFrequency",

0 commit comments

Comments
 (0)