Skip to content

Commit ec65243

Browse files
fixup! Add a regression test for the timezone issue
1 parent 7a6a48b commit ec65243

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

pandas/tests/indexing/test_datetime.py

+10-11
Original file line numberDiff line numberDiff line change
@@ -360,15 +360,14 @@ def test_loc_label_slicing(self):
360360
def test_apply_datetime_tz_issue(self):
361361
# GH 29052
362362

363-
df = DataFrame(
364-
data=[0, 1, 2],
365-
index=[
366-
pd.Timestamp("2019-03-15 12:34:31.909000+0000", tz="UTC"),
367-
pd.Timestamp("2019-03-15 12:34:34.359000+0000", tz="UTC"),
368-
pd.Timestamp("2019-03-15 12:34:34.660000+0000", tz="UTC"),
369-
],
370-
)
371-
df2 = df.apply(lambda x: x.name, axis=1)
363+
timestamps = [
364+
pd.Timestamp("2019-03-15 12:34:31.909000+0000", tz="UTC"),
365+
pd.Timestamp("2019-03-15 12:34:34.359000+0000", tz="UTC"),
366+
pd.Timestamp("2019-03-15 12:34:34.660000+0000", tz="UTC"),
367+
]
368+
df = DataFrame(data=[0, 1, 2], index=timestamps)
369+
result = df.apply(lambda x: x.name, axis=1)
370+
expected = pd.Series(index=timestamps, data=timestamps)
371+
372+
tm.assert_series_equal(result, expected)
372373

373-
assert df[0].keys().dtype == df2.dtypes
374-
assert (df[0].keys().values == df2.values).all()

0 commit comments

Comments
 (0)