It's possible to create calculations based on python scripts with Tableau, but there's many steps involved. Here's a how-to guide.
Regarding Python, different visualisation tools use it for different purposes. For instance, PowerBI allows you to create new charts types with Python, but you can't use it in calculated key figures.
With Tableau, the important thing to note is that Python will return the result of a calculation but can't be used to create a new chart type.
First you need to install Python on your machine from the python website.
You also need to install popular libraries for charts such as matplotlib and seaborn.
You also need to install the Tableau package TabPy.
In order to do so, use the pip tool (it's normally packaged with python).
Open the Windows command prompt (cmd) and type commands such as:
pip install matplotlib
pip install seaborn
pip install tabpy
Start the service in the Windows command prompt (cmd) with the command below. You might get a warning from your firewall asking you to authorise this program.
tabpy
Open Tableau Desktop and enable the service with the Help menu / Settings and Performance / Manage Analytics Extension Connection.
Enter Server = localhost; Port = 9004. Click "OK".
I've got version 2020.4 and I didn't get a confirmation message but still it worked.
You can now use Python with Tableau !
Next step is to implement some Python code.
Implementation is done within a calculated field. You can enter scripts there that do just about anything. Like any other calculated field, you can leverage parameters for instance.
Resources:
Comments