From 350202dfb13880cffd7023be60ef517986555784 Mon Sep 17 00:00:00 2001 From: Richard Shadrach Date: Tue, 9 Sep 2025 18:15:59 -0400 Subject: [PATCH] DEPR: Improve commenting around two deprecations --- pandas/_libs/tslibs/period.pyx | 2 +- pandas/core/generic.py | 3 ++- pandas/core/resample.py | 3 ++- pandas/tests/resample/test_base.py | 1 + 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pandas/_libs/tslibs/period.pyx b/pandas/_libs/tslibs/period.pyx index 95a18f8cb2cad..426b464ecb4ec 100644 --- a/pandas/_libs/tslibs/period.pyx +++ b/pandas/_libs/tslibs/period.pyx @@ -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 " diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 7b91ca3d564a2..ecaac701a74a4 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -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 warnings.warn( f"The 'convention' keyword in {type(self).__name__}.resample is " "deprecated and will be removed in a future version. " diff --git a/pandas/core/resample.py b/pandas/core/resample.py index 5ae88cff55d6d..36cbf16b2f198 100644 --- a/pandas/core/resample.py +++ b/pandas/core/resample.py @@ -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.", diff --git a/pandas/tests/resample/test_base.py b/pandas/tests/resample/test_base.py index d9bd89af61aaf..fc734a0cf95d3 100644 --- a/pandas/tests/resample/test_base.py +++ b/pandas/tests/resample/test_base.py @@ -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"