We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0350b56 commit c9d96a7Copy full SHA for c9d96a7
pandas/tests/series/methods/test_combine.py
@@ -1,12 +1,13 @@
1
-from pandas import Series
+from pandas import (
2
+ NA,
3
+ Series,
4
+)
5
import pandas._testing as tm
6
7
8
class TestCombine:
9
def test_combine_scalar(self):
10
# GH#21248
- # Note - combine() with another Series is tested elsewhere because
- # it is used when testing operators
11
ser = Series([i * 10 for i in range(5)])
12
result = ser.combine(3, lambda x, y: x + y)
13
expected = Series([i * 10 + 3 for i in range(5)])
@@ -15,3 +16,11 @@ def test_combine_scalar(self):
15
16
result = ser.combine(22, lambda x, y: min(x, y))
17
expected = Series([min(i * 10, 22) for i in range(5)])
18
tm.assert_series_equal(result, expected)
19
+
20
+ def test_combine_series(self):
21
+ # GH#31899
22
+ s1 = Series([91, NA, 94], dtype="Int8")
23
+ s2 = Series([91, NA, 11], dtype="Int8")
24
+ result = s1.combine(s2, lambda x, y: x + y)
25
+ expected = Series([-74, NA, 105], dtype="Int8") # dtype should be preserved
26
+ tm.assert_series_equal(result, expected)
0 commit comments