@@ -59,20 +59,19 @@ def build_wrapper_function(func, variables, array_input, setup=None,
5959 func = func .__name__ if callable (func ) else func
6060
6161 # HELPER: SAS to python char issue where SAS char have spaces and python string does not.
62- # NOTE: we assume SAS char always need white space to be trimmed. This seems to match python model built so far
63- pythonStringInput = ('' ,)
64- for tmp1 in variables :
65- if not tmp1 .out :
66- if tmp1 .type == 'char' :
67- pythonStringInput = pythonStringInput + (" if " + tmp1 .name + ": " + tmp1 .name + " = " + tmp1 .name + ".strip()" ,)
62+ # NOTE: we assume SAS char always need white space to be trimmed. This seems to match python model built so far
63+ string_input = ('' , )
64+ for v in variables :
65+ if v .type == 'char' and not v .out :
66+ string_input += (" if {0}: {0} = {0}.strip()" .format (v .name ), )
6867
6968 # Statement to execute the function w/ provided parameters
7069 if array_input :
71- middle = pythonStringInput + \
70+ middle = string_input + \
7271 (' inputarray = np.array([{}]).reshape((1, -1))' .format (',' .join (args )),
73- ' column= [{}]' .format (',' .join ('"{0}"' . format (w ) for w in args )),
72+ ' column = [{}]' .format (',' .join (str (w ) for w in args )),
7473 ' import pandas as pd' ,
75- ' inputrun= pd.DataFrame(data=inputarray, columns=column)' ,
74+ ' inputrun = pd.DataFrame(data=inputarray, columns=column)' ,
7675 ' result = {}(inputrun)' .format (func ))
7776 else :
7877 func_call = '{}({})' .format (func , ',' .join (args ))
0 commit comments