From 6987cdda8ebc3cbe9479c88bb1f88a2de9bab2fe Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Mon, 13 Oct 2025 02:57:02 +0000 Subject: [PATCH 1/2] add test for combine between two series --- pandas/tests/series/methods/test_combine.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pandas/tests/series/methods/test_combine.py b/pandas/tests/series/methods/test_combine.py index 75d47e3daa103..2c102accdf626 100644 --- a/pandas/tests/series/methods/test_combine.py +++ b/pandas/tests/series/methods/test_combine.py @@ -1,12 +1,13 @@ -from pandas import Series +from pandas import ( + NA, + Series, +) import pandas._testing as tm class TestCombine: def test_combine_scalar(self): # GH#21248 - # Note - combine() with another Series is tested elsewhere because - # it is used when testing operators ser = Series([i * 10 for i in range(5)]) result = ser.combine(3, lambda x, y: x + y) expected = Series([i * 10 + 3 for i in range(5)]) @@ -15,3 +16,13 @@ def test_combine_scalar(self): result = ser.combine(22, lambda x, y: min(x, y)) expected = Series([min(i * 10, 22) for i in range(5)]) tm.assert_series_equal(result, expected) + + def test_combine_series(self): + # GH#31899 + # Note - combine() with another Series is also tested elsewhere because + # it is used when testing operators + s1 = Series([91, NA, 94], dtype="Int8") + s2 = Series([91, NA, 11], dtype="Int8") + result = s1.combine(s2, lambda x, y: x + y) + expected = Series([-74, NA, 105], dtype="Int8") # dtype should be preserved + tm.assert_series_equal(result, expected) From eb031e188f9b6f47a507f2e6b881705c4935ca9c Mon Sep 17 00:00:00 2001 From: Tim Smith Date: Tue, 21 Oct 2025 22:43:07 +0000 Subject: [PATCH 2/2] Remove unneeded comment --- pandas/tests/series/methods/test_combine.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/pandas/tests/series/methods/test_combine.py b/pandas/tests/series/methods/test_combine.py index 2c102accdf626..06b830d3db3e1 100644 --- a/pandas/tests/series/methods/test_combine.py +++ b/pandas/tests/series/methods/test_combine.py @@ -19,8 +19,6 @@ def test_combine_scalar(self): def test_combine_series(self): # GH#31899 - # Note - combine() with another Series is also tested elsewhere because - # it is used when testing operators s1 = Series([91, NA, 94], dtype="Int8") s2 = Series([91, NA, 11], dtype="Int8") result = s1.combine(s2, lambda x, y: x + y)