@@ -1813,8 +1813,6 @@ def _resampler_for_grouping(self) -> type[DatetimeIndexResamplerGroupby]:
1813
1813
1814
1814
def _get_binner_for_time (self ):
1815
1815
# 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 )
1818
1816
return self ._timegrouper ._get_time_bins (self .ax )
1819
1817
1820
1818
def _downsample (self , how , ** kwargs ):
@@ -1838,17 +1836,6 @@ def _downsample(self, how, **kwargs):
1838
1836
assert obj .index .freq == self .freq , (obj .index .freq , self .freq )
1839
1837
return obj
1840
1838
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
-
1852
1839
# we are downsampling
1853
1840
# we want to call the actual grouper method here
1854
1841
result = obj .groupby (self ._grouper ).aggregate (how , ** kwargs )
@@ -1955,8 +1942,6 @@ def _resampler_for_grouping(self):
1955
1942
return PeriodIndexResamplerGroupby
1956
1943
1957
1944
def _get_binner_for_time (self ):
1958
- if isinstance (self .ax , DatetimeIndex ):
1959
- return super ()._get_binner_for_time ()
1960
1945
return self ._timegrouper ._get_period_bins (self .ax )
1961
1946
1962
1947
def _convert_obj (self , obj : NDFrameT ) -> NDFrameT :
@@ -1971,10 +1956,6 @@ def _convert_obj(self, obj: NDFrameT) -> NDFrameT:
1971
1956
)
1972
1957
raise NotImplementedError (msg )
1973
1958
1974
- # convert to timestamp
1975
- if isinstance (obj , DatetimeIndex ):
1976
- obj = obj .to_timestamp (how = self .convention )
1977
-
1978
1959
return obj
1979
1960
1980
1961
def _downsample (self , how , ** kwargs ):
@@ -1986,10 +1967,6 @@ def _downsample(self, how, **kwargs):
1986
1967
how : string / cython mapped function
1987
1968
**kwargs : kw args passed to how function
1988
1969
"""
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
-
1993
1970
ax = self .ax
1994
1971
1995
1972
if is_subperiod (ax .freq , self .freq ):
@@ -2023,10 +2000,6 @@ def _upsample(self, method, limit: int | None = None, fill_value=None):
2023
2000
fill_value : scalar, default None
2024
2001
Value to use for missing values.
2025
2002
"""
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
-
2030
2003
ax = self .ax
2031
2004
obj = self .obj
2032
2005
new_index = self .binner
0 commit comments