import pandas as pd
import pandas.testing
index = pd.date_range("1-1-2000", "2-15-2000", freq="h").union(pd.date_range("4-15-2000", "5-15-2000", freq="h"))
s = pd.Series(range(len(index)), index=index)
left = s.resample("D", label="right", closed="right").count()
right = s.resample("24h", label="right", closed="right").count()
pandas.testing.assert_series_equal(left, right)
AssertionError: Series are different
Series length are different
[left]: 137, DatetimeIndex(['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04',
'2000-01-05', '2000-01-06', '2000-01-07', '2000-01-08',
'2000-01-09', '2000-01-10',
...
'2000-05-07', '2000-05-08', '2000-05-09', '2000-05-10',
'2000-05-11', '2000-05-12', '2000-05-13', '2000-05-14',
'2000-05-15', '2000-05-16'],
dtype='datetime64[ns]', length=137, freq='D')
[right]: 136, DatetimeIndex(['2000-01-01', '2000-01-02', '2000-01-03', '2000-01-04',
'2000-01-05', '2000-01-06', '2000-01-07', '2000-01-08',
'2000-01-09', '2000-01-10',
...
'2000-05-06', '2000-05-07', '2000-05-08', '2000-05-09',
'2000-05-10', '2000-05-11', '2000-05-12', '2000-05-13',
'2000-05-14', '2000-05-15'],
dtype='datetime64[ns]', length=136, freq='24h')
Pandas version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest version of pandas.
I have confirmed this bug exists on the main branch of pandas.
Reproducible Example
Issue Description
That program passes without error with pandas==2.3.2, but fails with
3.0.0.dev0+2339.g1af0a95e94. The failure isExpected Behavior
Uncertain. I think this is related to #35248 and the fix from #61985. I'm not 100% sure whether the old behavior was buggy and this was a deliberate change. But #35248 mentions "24h" and "1D" behaving differently, so perhaps this is a regresssion.
Installed Versions
Details