Skip to content
Merged
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
27 changes: 0 additions & 27 deletions pandas/core/resample.py
Original file line number Diff line number Diff line change
Expand Up @@ -1813,8 +1813,6 @@ def _resampler_for_grouping(self) -> type[DatetimeIndexResamplerGroupby]:

def _get_binner_for_time(self):
# this is how we are actually creating the bins
if isinstance(self.ax, PeriodIndex):
return self._timegrouper._get_time_period_bins(self.ax)
return self._timegrouper._get_time_bins(self.ax)

def _downsample(self, how, **kwargs):
Expand All @@ -1838,17 +1836,6 @@ def _downsample(self, how, **kwargs):
assert obj.index.freq == self.freq, (obj.index.freq, self.freq)
return obj

# do we have a regular frequency

# error: Item "None" of "Optional[Any]" has no attribute "binlabels"
if (
(ax.freq is not None or ax.inferred_freq is not None)
and len(self._grouper.binlabels) > len(ax)
and how is None
):
# let's do an asfreq
return self.asfreq()

# we are downsampling
# we want to call the actual grouper method here
result = obj.groupby(self._grouper).aggregate(how, **kwargs)
Expand Down Expand Up @@ -1955,8 +1942,6 @@ def _resampler_for_grouping(self):
return PeriodIndexResamplerGroupby

def _get_binner_for_time(self):
if isinstance(self.ax, DatetimeIndex):
return super()._get_binner_for_time()
return self._timegrouper._get_period_bins(self.ax)

def _convert_obj(self, obj: NDFrameT) -> NDFrameT:
Expand All @@ -1971,10 +1956,6 @@ def _convert_obj(self, obj: NDFrameT) -> NDFrameT:
)
raise NotImplementedError(msg)

# convert to timestamp
if isinstance(obj, DatetimeIndex):
obj = obj.to_timestamp(how=self.convention)

return obj

def _downsample(self, how, **kwargs):
Expand All @@ -1986,10 +1967,6 @@ def _downsample(self, how, **kwargs):
how : string / cython mapped function
**kwargs : kw args passed to how function
"""
# we may need to actually resample as if we are timestamps
if isinstance(self.ax, DatetimeIndex):
return super()._downsample(how, **kwargs)

ax = self.ax

if is_subperiod(ax.freq, self.freq):
Expand Down Expand Up @@ -2023,10 +2000,6 @@ def _upsample(self, method, limit: int | None = None, fill_value=None):
fill_value : scalar, default None
Value to use for missing values.
"""
# we may need to actually resample as if we are timestamps
if isinstance(self.ax, DatetimeIndex):
return super()._upsample(method, limit=limit, fill_value=fill_value)

ax = self.ax
obj = self.obj
new_index = self.binner
Expand Down
Loading