Skip to content
Closed
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
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/period.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -3018,7 +3018,7 @@ class Period(_Period):
# GH#53446
import warnings

# TODO: Enforce in 3.0 (#53511)
# TODO: Need to find an alternative before this deprecation can be enforced (#53511)
from pandas.util._exceptions import find_stack_level
warnings.warn(
"Period with BDay freq is deprecated and will be removed "
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -9136,7 +9136,8 @@ def resample(
from pandas.core.resample import get_resampler

if convention is not lib.no_default:
# TODO: Enforce in 3.0 (#55968)
# TODO: Plan to fix resampling with PeriodIndex instead (#55968)
# see https://github.com/pandas-dev/pandas/pull/62270#issuecomment-3262411892
Comment on lines +9139 to +9140
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also update the warning message with something similar? (that it won't be removed if it can be fixed)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to me that could encourage users to not use alternatives, which I think is the purpose of keeping the warning with the current behavior.

warnings.warn(
f"The 'convention' keyword in {type(self).__name__}.resample is "
"deprecated and will be removed in a future version. "
Expand Down
3 changes: 2 additions & 1 deletion pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -1945,7 +1945,8 @@ class PeriodIndexResampler(DatetimeIndexResampler):

@property
def _resampler_for_grouping(self):
# TODO: Enforce in 3.0 (#55968)
# TODO: Plan to fix resampling with PeriodIndex instead (#55968)
# see https://github.com/pandas-dev/pandas/pull/62270#issuecomment-3262411892
warnings.warn(
"Resampling a groupby with a PeriodIndex is deprecated. "
"Cast to DatetimeIndex before resampling instead.",
Expand Down
1 change: 1 addition & 0 deletions pandas/tests/resample/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -473,6 +473,7 @@ def test_resample_empty_dtypes(index, dtype, resample_method):
warn = None
if isinstance(index, PeriodIndex):
# GH#53511
# TODO: Need to find an alternative before this deprecation can be enforced
index = PeriodIndex([], freq="B", name=index.name)
warn = FutureWarning
msg = "Resampling with a PeriodIndex is deprecated"
Expand Down
Loading