Skip to content

Commit 753a25b

Browse files
committed
CLN: remove unreachable in resample
1 parent 98c9c7f commit 753a25b

File tree

1 file changed

+0
-27
lines changed

1 file changed

+0
-27
lines changed

pandas/core/resample.py

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1813,8 +1813,6 @@ def _resampler_for_grouping(self) -> type[DatetimeIndexResamplerGroupby]:
18131813

18141814
def _get_binner_for_time(self):
18151815
# this is how we are actually creating the bins
1816-
if isinstance(self.ax, PeriodIndex):
1817-
return self._timegrouper._get_time_period_bins(self.ax)
18181816
return self._timegrouper._get_time_bins(self.ax)
18191817

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

1841-
# do we have a regular frequency
1842-
1843-
# error: Item "None" of "Optional[Any]" has no attribute "binlabels"
1844-
if (
1845-
(ax.freq is not None or ax.inferred_freq is not None)
1846-
and len(self._grouper.binlabels) > len(ax)
1847-
and how is None
1848-
):
1849-
# let's do an asfreq
1850-
return self.asfreq()
1851-
18521839
# we are downsampling
18531840
# we want to call the actual grouper method here
18541841
result = obj.groupby(self._grouper).aggregate(how, **kwargs)
@@ -1955,8 +1942,6 @@ def _resampler_for_grouping(self):
19551942
return PeriodIndexResamplerGroupby
19561943

19571944
def _get_binner_for_time(self):
1958-
if isinstance(self.ax, DatetimeIndex):
1959-
return super()._get_binner_for_time()
19601945
return self._timegrouper._get_period_bins(self.ax)
19611946

19621947
def _convert_obj(self, obj: NDFrameT) -> NDFrameT:
@@ -1971,10 +1956,6 @@ def _convert_obj(self, obj: NDFrameT) -> NDFrameT:
19711956
)
19721957
raise NotImplementedError(msg)
19731958

1974-
# convert to timestamp
1975-
if isinstance(obj, DatetimeIndex):
1976-
obj = obj.to_timestamp(how=self.convention)
1977-
19781959
return obj
19791960

19801961
def _downsample(self, how, **kwargs):
@@ -1986,10 +1967,6 @@ def _downsample(self, how, **kwargs):
19861967
how : string / cython mapped function
19871968
**kwargs : kw args passed to how function
19881969
"""
1989-
# we may need to actually resample as if we are timestamps
1990-
if isinstance(self.ax, DatetimeIndex):
1991-
return super()._downsample(how, **kwargs)
1992-
19931970
ax = self.ax
19941971

19951972
if is_subperiod(ax.freq, self.freq):
@@ -2023,10 +2000,6 @@ def _upsample(self, method, limit: int | None = None, fill_value=None):
20232000
fill_value : scalar, default None
20242001
Value to use for missing values.
20252002
"""
2026-
# we may need to actually resample as if we are timestamps
2027-
if isinstance(self.ax, DatetimeIndex):
2028-
return super()._upsample(method, limit=limit, fill_value=fill_value)
2029-
20302003
ax = self.ax
20312004
obj = self.obj
20322005
new_index = self.binner

0 commit comments

Comments
 (0)