Implementing Python functionality
Just like R, TabPy makes use of the script functions in Tableau. In the next sections, we will practice working with TabPy and will look at multiple use cases. Tableau calculations using TabPy look very similar to R's. For TabPy, it is important to add a return
statement in the calculated field and notice that arguments are noted with an underscore instead of a dot:
Figure 15.30: Python TabPy syntax
This will be manifested in the next exercises; we will first look into random number generators.
Random and random normal
Many calculations are easily accessible via the calculated fields, others via the table calculations—and then there are some hidden functions. If you tried to find the function Random
for example, you wouldn't. But you can still use the Random()
function as can be seen here:
Figure 15.31: Random
Another option is, using TabPy to get the Random
function. We will look at random as well...