Skip to content

Commit 6689f57

Browse files
TST: Add test with mask on LHS for test_setitem_with_unaligned_tz_aware_datetime_column
GH12981: addressed jreback's comment
1 parent 1347398 commit 6689f57

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

doc/source/whatsnew/v0.18.1.txt

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,5 +434,4 @@ Bug Fixes
434434
- ``pd.read_excel()`` now accepts path objects (e.g. ``pathlib.Path``, ``py.path.local``) for the file path, in line with other ``read_*`` functions (:issue:`12655`)
435435
- ``pd.read_excel()`` now accepts column names associated with keyword argument ``names``(:issue `12870`)
436436

437-
- Bug in ``DataFrame._santize_column`` now preserves Timezone when RHS is a Series (:issue `12981`)
438-
437+
- Bug in ``DataFrame`` timezone lost when assigning tz-aware datetime ``Series`` with alignment (:issue `12981`)

pandas/tests/frame/test_indexing.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1950,6 +1950,9 @@ def test_setitem_with_unaligned_tz_aware_datetime_column(self):
19501950
df['dates'] = column[[1, 0, 2]]
19511951
assert_series_equal(df['dates'], column)
19521952

1953+
df.loc[[0, 1, 2], 'dates'] = column[[1, 0, 2]]
1954+
assert_series_equal(df['dates'], column)
1955+
19531956
def test_setitem_datetime_coercion(self):
19541957
# GH 1048
19551958
df = pd.DataFrame({'c': [pd.Timestamp('2010-10-01')] * 3})

0 commit comments

Comments
 (0)