Skip to content

REF: Implement NullFrequencyError in pd.errors #34144

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 3 commits into from
May 13, 2020
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
1 change: 1 addition & 0 deletions doc/source/reference/general_utility_functions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ Exceptions and warnings
errors.EmptyDataError
errors.OutOfBoundsDatetime
errors.MergeError
errors.NullFrequencyError
errors.NumbaUtilError
errors.ParserError
errors.ParserWarning
Expand Down
3 changes: 1 addition & 2 deletions pandas/_libs/tslibs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
"ints_to_pytimedelta",
"Timestamp",
"tz_convert_single",
"NullFrequencyError",
]


Expand All @@ -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
9 changes: 0 additions & 9 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 11 additions & 1 deletion pandas/errors/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion pandas/tests/tslibs/test_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ def test_namespace():
"iNaT",
"is_null_datetimelike",
"nat_strings",
"NullFrequencyError",
"OutOfBoundsDatetime",
"Period",
"IncompatibleFrequency",
Expand Down