Skip to content

Commit 0a35a30

Browse files
committed
TST: Check DatetimeIndex.drop on DST boundary
Closes pandas-devgh-18031.
1 parent 647f3f0 commit 0a35a30

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

pandas/tests/indexes/datetimes/test_ops.py

+22
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,28 @@ def test_drop_duplicates_metadata(self):
307307
tm.assert_index_equal(idx, result)
308308
assert result.freq is None
309309

310+
def test_drop_dst_boundary(self):
311+
# see gh-18031
312+
tz = "Europe/Brussels"
313+
freq = "15min"
314+
315+
start = pd.Timestamp("201710290100", tz=tz)
316+
end = pd.Timestamp("201710290300", tz=tz)
317+
index = pd.date_range(start=start, end=end, freq=freq)
318+
319+
expected = DatetimeIndex(["201710290115", "201710290130",
320+
"201710290145", "201710290200",
321+
"201710290215", "201710290230",
322+
"201710290245", "201710290200",
323+
"201710290215", "201710290230",
324+
"201710290245", "201710290300"],
325+
tz=tz, freq=freq,
326+
ambiguous=[True, True, True, True,
327+
True, True, True, False,
328+
False, False, False, False])
329+
result = index.drop(index[0])
330+
tm.assert_index_equal(result, expected)
331+
310332
def test_drop_duplicates(self):
311333
# to check Index/Series compat
312334
base = pd.date_range('2011-01-01', '2011-01-31', freq='D', name='idx')

0 commit comments

Comments
 (0)