#NEWLINE# @ staticmethod #NEWLINE# def map_values( field , value_map , default_value ) : #NEWLINE# #INDENT# mv = pmml . MapValues ( outputColumn = 'output' , default_value = default_value ) #NEWLINE# mv . append ( pmml . FieldColumnPair ( field = field , column = 'input' ) ) #NEWLINE# it = pmml . InlineTable ( ) #NEWLINE# for ( k , v ) in value_map . items ( ) : #NEWLINE# #INDENT# it . append ( pmml_row ( input = k , output = v ) ) #NEWLINE# #UNINDENT# mv . append ( it ) #NEWLINE# return { #NEWLINE# #INDENT# DerivedFeatureTransformations . TRANSFORMATION : mv , #NEWLINE# DerivedFeatureTransformations . FUNCTION : ( lambda df : np . vectorize ( partial ( value_map . get , default_value ) ) ( df [ field ] ) ) , #NEWLINE# #UNINDENT# }