Skip to content

Commit 85c7900

Browse files
readyready15728TomAugspurger
authored andcommitted
TST: Added test for mapping on mixed NA (#20574)
Closes #20495
1 parent 73cb32e commit 85c7900

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

pandas/tests/series/test_apply.py

+11
Original file line numberDiff line numberDiff line change
@@ -576,3 +576,14 @@ def f(x):
576576
result = s.map(f)
577577
exp = pd.Series(['Asia/Tokyo'] * 25, name='XX')
578578
tm.assert_series_equal(result, exp)
579+
580+
@pytest.mark.parametrize("vals,mapping,exp", [
581+
(list('abc'), {np.nan: 'not NaN'}, [np.nan] * 3 + ['not NaN']),
582+
(list('abc'), {'a': 'a letter'}, ['a letter'] + [np.nan] * 3),
583+
(list(range(3)), {0: 42}, [42] + [np.nan] * 3)])
584+
def test_map_missing_mixed(self, vals, mapping, exp):
585+
# GH20495
586+
s = pd.Series(vals + [np.nan])
587+
result = s.map(mapping)
588+
589+
tm.assert_series_equal(result, pd.Series(exp))

0 commit comments

Comments
 (0)