diff --git a/pandas/core/resample.py b/pandas/core/resample.py index ebb803ee8f3b4..255b926ba226a 100644 --- a/pandas/core/resample.py +++ b/pandas/core/resample.py @@ -151,7 +151,6 @@ def __init__( *, group_keys: bool | lib.NoDefault = lib.no_default, selection=None, - **kwargs, ) -> None: self._timegrouper = groupby self.keys = None @@ -171,18 +170,6 @@ def __init__( else: self.exclusions = frozenset() - @final - def _shallow_copy(self, obj, **kwargs): - """ - return a new object with the replacement attributes - """ - if isinstance(obj, self._constructor): - obj = obj.obj - for attr in self._attributes: - if attr not in kwargs: - kwargs[attr] = getattr(self, attr) - return self._constructor(obj, **kwargs) - def __str__(self) -> str: """ Provide a nice str repr of our rolling object. @@ -1181,7 +1168,7 @@ def _apply(self, f, *args, **kwargs): """ def func(x): - x = self._shallow_copy(x, groupby=self._timegrouper) + x = self._resampler_cls(x, groupby=self._timegrouper) if isinstance(f, str): return getattr(x, f)(**kwargs) @@ -1364,7 +1351,7 @@ class DatetimeIndexResamplerGroupby(_GroupByMixin, DatetimeIndexResampler): """ @property - def _constructor(self): + def _resampler_cls(self): return DatetimeIndexResampler @@ -1476,7 +1463,7 @@ class PeriodIndexResamplerGroupby(_GroupByMixin, PeriodIndexResampler): """ @property - def _constructor(self): + def _resampler_cls(self): return PeriodIndexResampler @@ -1504,7 +1491,7 @@ class TimedeltaIndexResamplerGroupby(_GroupByMixin, TimedeltaIndexResampler): """ @property - def _constructor(self): + def _resampler_cls(self): return TimedeltaIndexResampler