Skip to content

Commit 4a3bcfa

Browse files
Last fixes
1 parent c3afd05 commit 4a3bcfa

File tree

3 files changed

+6
-14
lines changed

3 files changed

+6
-14
lines changed

pandas/core/series.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4345,7 +4345,7 @@ def map(
43454345
mapping correspondence.
43464346
engine : decorator, optional
43474347
Choose the execution engine to use to run the function. Only used for
4348-
functions. If ``map`` is called with a mapping or ``Series``, and
4348+
functions. If ``map`` is called with a mapping or ``Series``, an
43494349
exception will be raised. If ``engine`` is not provided the function will
43504350
be executed by the regular Python interpreter.
43514351
@@ -4358,8 +4358,7 @@ def map(
43584358
Not all functions can be executed with all execution engines. In general,
43594359
JIT compilers will require type stability in the function (no variable
43604360
should change data type during the execution). And not all pandas and
4361-
NumPy APIs are supported. Check the engine documentation [1]_ and [2]_
4362-
for limitations.
4361+
NumPy APIs are supported. Check the engine documentation for limitations.
43634362
43644363
.. versionadded:: 3.0.0
43654364

pandas/tests/apply/common.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ class MockExecutionEngine(BaseExecutionEngine):
2929

3030
def map(data, func, args, kwargs, decorator, skip_na):
3131
kwargs_to_pass = kwargs if isinstance(data, DataFrame) else {}
32-
return data.map(
33-
func, action_na="ignore" if skip_na else False, **kwargs_to_pass
34-
)
32+
return data.map(func, na_action="ignore" if skip_na else None, **kwargs_to_pass)
3533

3634
def apply(data, func, args, kwargs, decorator, axis):
3735
if isinstance(data, Series):

pandas/tests/series/methods/test_map.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -634,17 +634,12 @@ def test_map_func_is_none():
634634
Series([1, 2]).map(func=None)
635635

636636

637-
def test_map_engine_no_function():
637+
@pytest.mark.parametrize("func", [{}, {1: 2}, Series([3, 4])])
638+
def test_map_engine_no_function(func):
638639
s = Series([1, 2])
639640

640641
with pytest.raises(ValueError, match="engine argument can only be specified"):
641-
s.map({}, engine="something")
642-
643-
with pytest.raises(ValueError, match="engine argument can only be specified"):
644-
s.map({1: 2}, engine="something")
645-
646-
with pytest.raises(ValueError, match="engine argument can only be specified"):
647-
s.map(Series([3, 4]), engine="something")
642+
s.map(func, engine="something")
648643

649644

650645
def test_map_engine_not_executor():

0 commit comments

Comments
 (0)