File tree 1 file changed +9
-3
lines changed 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 6
6
# pylint: disable=E1101,E1103
7
7
# pylint: disable=W0703,W0622,W0613,W0201
8
8
9
+ import collections
9
10
import types
10
11
import warnings
11
12
@@ -2132,10 +2133,15 @@ def map_f(values, f):
2132
2133
else :
2133
2134
map_f = lib .map_infer
2134
2135
2135
- if isinstance (arg , (dict , Series )):
2136
- if isinstance (arg , dict ):
2137
- arg = self ._constructor (arg , index = arg .keys ())
2136
+ default_dict_types = collections .Counter , collections .defaultdict
2137
+ if isinstance (arg , default_dict_types ):
2138
+ dict_with_default = arg
2139
+ arg = lambda x : dict_with_default [x ]
2138
2140
2141
+ elif isinstance (arg , dict ):
2142
+ arg = self ._constructor (arg , index = arg .keys ())
2143
+
2144
+ if isinstance (arg , Series ):
2139
2145
indexer = arg .index .get_indexer (values )
2140
2146
new_values = algorithms .take_1d (arg ._values , indexer )
2141
2147
else :
You can’t perform that action at this time.
0 commit comments