Skip to content

Commit e623f0f

Browse files
grigoriosgiannjreback
authored andcommitted
Add a regression test for the timezone issue (pandas-dev#29097)
1 parent 04893a9 commit e623f0f

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

pandas/tests/frame/test_apply.py

+14
Original file line numberDiff line numberDiff line change
@@ -1346,3 +1346,17 @@ def test_frequency_is_original(self, num_cols):
13461346
df = DataFrame(1, index=index, columns=range(num_cols))
13471347
df.apply(lambda x: x)
13481348
assert index.freq == original.freq
1349+
1350+
def test_apply_datetime_tz_issue(self):
1351+
# GH 29052
1352+
1353+
timestamps = [
1354+
pd.Timestamp("2019-03-15 12:34:31.909000+0000", tz="UTC"),
1355+
pd.Timestamp("2019-03-15 12:34:34.359000+0000", tz="UTC"),
1356+
pd.Timestamp("2019-03-15 12:34:34.660000+0000", tz="UTC"),
1357+
]
1358+
df = DataFrame(data=[0, 1, 2], index=timestamps)
1359+
result = df.apply(lambda x: x.name, axis=1)
1360+
expected = pd.Series(index=timestamps, data=timestamps)
1361+
1362+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)