From fe83ce9243715c02c13dfe4cc5bcce463f2de0c3 Mon Sep 17 00:00:00 2001 From: William Ayd Date: Mon, 13 Nov 2023 13:53:11 -0500 Subject: [PATCH] Backport PR #55920: Fix off-by-one in aggregations --- pandas/core/indexers/objects.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandas/core/indexers/objects.py b/pandas/core/indexers/objects.py index 694a420ad2494..b516227cf8b06 100644 --- a/pandas/core/indexers/objects.py +++ b/pandas/core/indexers/objects.py @@ -102,7 +102,7 @@ def get_window_bounds( closed: str | None = None, step: int | None = None, ) -> tuple[np.ndarray, np.ndarray]: - if center: + if center or self.window_size == 0: offset = (self.window_size - 1) // 2 else: offset = 0