When resampling a pandas DatetimeIndex, why would resampling daily (rule="D") or hourly (rule="H") between two dates be faster than resampling weekly ("W"), monthly ("M") or yearly ("Y")?

df = pd.DataFrame({"data": ["A", "A"]}, index = pd.DatetimeIndex(["2010-01-01", "2020-01-01"]))

df.resample("D").bfill()
1.27 ms ± 121 µs per loop (mean ± std. dev. of 10 runs, 10 loops each)

df.resample("H").bfill()
2.46 ms ± 115 µs per loop (mean ± std. dev. of 10 runs, 10 loops each)

df.resample("W").bfill()
12.2 ms ± 446 µs per loop (mean ± std. dev. of 10 runs, 10 loops each)

df.resample("M").bfill()
5.1 ms ± 506 µs per loop (mean ± std. dev. of 10 runs, 10 loops each)

df.resample("Y").bfill()
2.99 ms ± 160 µs per loop (mean ± std. dev. of 10 runs, 10 loops each)

One would expect that resampling with yearly frequency would be much faster than hourly because there is only 11 rows to compute vs 87k+ rows in the case of an hourly resampling.

Comment From: mroeschke

This is due to weekly monthly and yearly being non-fixed frequencies so they go through a slower code path than hours and days which are fixed frequencies