Skip to content

Commit 261d425

Browse files
authored
combine_first with mix tz test GH#26283 (#52294)
Signed-off-by: Liang Yan <[email protected]>
1 parent 825b5c3 commit 261d425

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

pandas/tests/series/methods/test_combine_first.py

+23
Original file line numberDiff line numberDiff line change
@@ -120,3 +120,26 @@ def test_combine_first_preserves_dtype(self):
120120
result = s1.combine_first(s2)
121121
expected = Series([1666880195890293744, 1666880195890293837, 3])
122122
tm.assert_series_equal(result, expected)
123+
124+
def test_combine_mixed_timezone(self):
125+
# GH 26283
126+
uniform_tz = Series({pd.Timestamp("2019-05-01", tz="UTC"): 1.0})
127+
multi_tz = Series(
128+
{
129+
pd.Timestamp("2019-05-01 01:00:00+0100", tz="Europe/London"): 2.0,
130+
pd.Timestamp("2019-05-02", tz="UTC"): 3.0,
131+
}
132+
)
133+
134+
result = uniform_tz.combine_first(multi_tz)
135+
expected = Series(
136+
[1.0, 3.0],
137+
index=pd.Index(
138+
[
139+
pd.Timestamp("2019-05-01 00:00:00+00:00", tz="UTC"),
140+
pd.Timestamp("2019-05-02 00:00:00+00:00", tz="UTC"),
141+
],
142+
dtype="object",
143+
),
144+
)
145+
tm.assert_series_equal(result, expected)

0 commit comments

Comments
 (0)