Hello,
I am new to Python Tableau integration.
My Python function script is returning a string but when i call the same in tableau with SCRIPT_STR it gives me error that type is not correct.
I can correctly use SCRIPT_INT. Please help me.
Hi Shankar,
Thanks for reply.
Please find below my calculation field code.
SCRIPT_STR("return tabpy.query('addTest'
,_arg1,_arg2,_arg3,_arg4,_arg5)['response']",
10,10,5,'S1','S2')
and Python Function :
import tabpy_client
import numpy as np
client = tabpy_client.Client('http://localhost:9004')
⌗def add(a,b):
# res = np.add(a,b).tolist()
# return res
def addTest(arg1,arg2,arg3,arg4,arg5):
out1 = np.divide(np.subtract(np.add(arg1,arg2) , arg3),np.mean([arg1,arg2,arg3])).tolist()
out2 = arg4 + '-' + arg5 + ':'
out3 = (out2 + str(out1))
return (out3)
client.deploy('addTest',addTest,'simple addition',override=True)
#client.remove('addTest')
#client.deploy('add',test,'simple mean',override=True)
⌗res = addTest(10,10,5,'S1','S2')
#print (res)