@@ -59,20 +59,19 @@ def build_wrapper_function(func, variables, array_input, setup=None,
59
59
func = func .__name__ if callable (func ) else func
60
60
61
61
# 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 ), )
68
67
69
68
# Statement to execute the function w/ provided parameters
70
69
if array_input :
71
- middle = pythonStringInput + \
70
+ middle = string_input + \
72
71
(' 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 )),
74
73
' import pandas as pd' ,
75
- ' inputrun= pd.DataFrame(data=inputarray, columns=column)' ,
74
+ ' inputrun = pd.DataFrame(data=inputarray, columns=column)' ,
76
75
' result = {}(inputrun)' .format (func ))
77
76
else :
78
77
func_call = '{}({})' .format (func , ',' .join (args ))
0 commit comments