Skip to content

TST: drop tz-aware timestamp from DatetimIndex with DST transition #23479

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 4, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v0.24.0.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1150,6 +1150,7 @@ Timezones
- Bug in :meth:`DatetimeIndex.unique` that did not re-localize tz-aware dates correctly (:issue:`21737`)
- Bug when indexing a :class:`Series` with a DST transition (:issue:`21846`)
- Bug in :meth:`DataFrame.resample` and :meth:`Series.resample` where an ``AmbiguousTimeError`` or ``NonExistentTimeError`` would raise if a timezone aware timeseries ended on a DST transition (:issue:`19375`, :issue:`10117`)
- Bug in :meth:`DataFrame.drop` and :meth:`Series.drop` when specifying a tz-aware Timestamp key to drop from a :class:`DatetimeIndex` with a DST transition (:issue:`21761`)
Copy link
Member

@gfyoung gfyoung Nov 4, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't call this a bug (or add any kind of whatsnew) when the test you added to break pandas passes on CI. 😉 🎉

Or was this broken in 0.23.4?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this ok, it was a previously fixed issue.


Offsets
^^^^^^^
Expand Down
13 changes: 13 additions & 0 deletions pandas/tests/test_multilevel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1931,6 +1931,19 @@ def test_drop_level_nonunique_datetime(self):
expected = df.loc[idx != 4]
tm.assert_frame_equal(result, expected)

@pytest.mark.parametrize('box', [Series, DataFrame])
def test_drop_tz_aware_timestamp_across_dst(self, box):
# GH 21761
start = Timestamp('2017-10-29', tz='Europe/Berlin')
end = Timestamp('2017-10-29 04:00:00', tz='Europe/Berlin')
index = pd.date_range(start, end, freq='15min')
data = box(data=[1] * len(index), index=index)
result = data.drop(start)
expected_start = Timestamp('2017-10-29 00:15:00', tz='Europe/Berlin')
expected_idx = pd.date_range(expected_start, end, freq='15min')
expected = box(data=[1] * len(expected_idx), index=expected_idx)
tm.assert_equal(result, expected)

def test_drop_preserve_names(self):
index = MultiIndex.from_arrays([[0, 0, 0, 1, 1, 1],
[1, 2, 3, 1, 2, 3]],
Expand Down