From 6e69154ecd2d3677c496edfaac1264a8a651d7a0 Mon Sep 17 00:00:00 2001 From: Nikhil-Narayanan Date: Wed, 24 Sep 2025 17:28:09 +0100 Subject: [PATCH] TST: unit testing resampled closed right boundary exclusion --- pandas/tests/resample/test_datetime_index.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/pandas/tests/resample/test_datetime_index.py b/pandas/tests/resample/test_datetime_index.py index 7b02b62bfd10c..990f0c7f5060a 100644 --- a/pandas/tests/resample/test_datetime_index.py +++ b/pandas/tests/resample/test_datetime_index.py @@ -2184,3 +2184,14 @@ def test_resample_A_raises(freq): s = Series(range(10), index=date_range("20130101", freq="D", periods=10)) with pytest.raises(ValueError, match=msg): s.resample(freq).mean() + + +def test_resample_closed_right_boundary_exclusion(): + # https://github.com/pandas-dev/pandas/issues/62154 + idx = date_range("2023-01-01 00:00:00", "2023-01-01 01:00:00", freq="30min") + s = Series([1, 2, 3], index=idx) + expected = Series( + [2], index=date_range("2023-01-01 00:00:00", periods=1, freq="1h") + ) + result = s.resample("1h", closed="right", label="left").sum() + tm.assert_series_equal(result, expected)