Skip to content

Commit d93e7e9

Browse files
committed
BUG - Allow a mapper of type collections.abc.Mapping when using
Series.map
1 parent c557629 commit d93e7e9

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

pandas/core/base.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
Base and utility classes for pandas objects.
33
"""
44
import builtins
5-
from collections import OrderedDict
5+
from collections import OrderedDict, abc
66
import textwrap
77
from typing import Dict, FrozenSet, List, Optional
88
import warnings
@@ -1215,7 +1215,7 @@ def _map_values(self, mapper, na_action=None):
12151215
# we can fastpath dict/Series to an efficient map
12161216
# as we know that we are not going to have to yield
12171217
# python types
1218-
if isinstance(mapper, dict):
1218+
if isinstance(mapper, abc.Mapping):
12191219
if hasattr(mapper, "__missing__"):
12201220
# If a dictionary subclass defines a default value method,
12211221
# convert mapper to a lookup function (GH #15999).

0 commit comments

Comments
 (0)