@@ -860,22 +860,15 @@ def map_f(values, f):
860860 arg = lambda x : dict_with_default [x ]
861861 else :
862862 # Dictionary does not have a default. Thus it's safe to
863- # convert to an Index for efficiency.
864- from pandas import Index
865- idx = Index (arg .keys ())
866- # Cast to dict so we can get values using lib.fast_multiget
867- # if this is a dict subclass (GH #15999)
868- map_values = idx ._get_values_from_dict (dict (arg ))
869- arg = idx
870- elif isinstance (arg , ABCSeries ):
871- map_values = arg .values
872- arg = arg .index
873-
874- if map_values is not None :
863+ # convert to an Series for efficiency.
864+ from pandas import Series
865+ arg = Series (arg , index = arg .keys ())
866+
867+ if isinstance (arg , ABCSeries ):
875868 # Since values were input this means we came from either
876869 # a dict or a series and arg should be an index
877- indexer = arg .get_indexer (values )
878- new_values = algorithms .take_1d (map_values , indexer )
870+ indexer = arg .index . get_indexer (values )
871+ new_values = algorithms .take_1d (arg . _values , indexer )
879872 else :
880873 # arg is a function
881874 new_values = map_f (values , arg )
0 commit comments