0

I have a tableau book with integrated TabPy I want to calculate chi square test and receive p value

SCRIPT_REAL(
"from scipy.stats import chi2_contingency 
data = [[_arg1, _arg2], [_arg3, arg4]] 
stat, p, dof, expected = chi2_contingency(data) 
return p"
, sum([orders A]), sum([not order A]), sum([orders B]), sum([not order B]))

But i receive this error

Unable to complete action
An error occurred while communicating with the Analytics Extension.
Error Code: 6116DD27
Error processing script
TypeError : '<' not supported between instances of 'NoneType' and 'int'

Please help me I tried the same logic with R in tableau - and everything goes well But what to do with Python - i don't know

When i enter some numbers in the data and don't use argument - it works

SCRIPT_REAL(
"from scipy.stats import chi2_contingency 
data = [[100, 120], [100, 130]] 
stat, p, dof, expected = chi2_contingency(data) 
return p"
, sum([orders A]), sum([not order A]), sum([orders B]), sum([not order B])
)

0 Answers0