Skip to content

Commit 86cc7b4

Browse files
tranctanproost
authored andcommitted
TST: DataFrameGroupBy.shift Loses TimeZone in datetime64 columns (pandas-dev#30153)
1 parent 5c9c8a9 commit 86cc7b4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

pandas/tests/groupby/test_groupby.py

+9
Original file line numberDiff line numberDiff line change
@@ -1702,6 +1702,15 @@ def test_group_shift_with_fill_value():
17021702
tm.assert_frame_equal(result, expected)
17031703

17041704

1705+
def test_group_shift_lose_timezone():
1706+
# GH 30134
1707+
now_dt = pd.Timestamp.utcnow()
1708+
df = DataFrame({"a": [1, 1], "date": now_dt})
1709+
result = df.groupby("a").shift(0).iloc[0]
1710+
expected = Series({"date": now_dt}, name=result.name)
1711+
tm.assert_series_equal(result, expected)
1712+
1713+
17051714
def test_pivot_table_values_key_error():
17061715
# This test is designed to replicate the error in issue #14938
17071716
df = pd.DataFrame(

0 commit comments

Comments
 (0)