@@ -919,22 +919,15 @@ def map_f(values, f):
919919 arg = lambda x : dict_with_default [x ]
920920 else :
921921 # Dictionary does not have a default. Thus it's safe to
922- # convert to an Index for efficiency.
923- from pandas import Index
924- idx = Index (arg .keys ())
925- # Cast to dict so we can get values using lib.fast_multiget
926- # if this is a dict subclass (GH #15999)
927- map_values = idx ._get_values_from_dict (dict (arg ))
928- arg = idx
929- elif isinstance (arg , ABCSeries ):
930- map_values = arg .values
931- arg = arg .index
932-
933- if map_values is not None :
922+ # convert to an Series for efficiency.
923+ from pandas import Series
924+ arg = Series (arg , index = arg .keys ())
925+
926+ if isinstance (arg , ABCSeries ):
934927 # Since values were input this means we came from either
935928 # a dict or a series and arg should be an index
936- indexer = arg .get_indexer (values )
937- new_values = algorithms .take_1d (map_values , indexer )
929+ indexer = arg .index . get_indexer (values )
930+ new_values = algorithms .take_1d (arg . _values , indexer )
938931 else :
939932 # arg is a function
940933 new_values = map_f (values , arg )
0 commit comments