Tableau is a powerful tool designed to create outstanding visualization. The state of the art technologies allow the creation not only static but also interactive visualizations on different granular levels. Different levels of granularity enable a developer to create a variety of vizzes to target a specific audience from the top-level management who require mostly aggregated data, for instance, to understand company development trends while other need data on a more detailed level. Furthermore, visualization can be updated dynamically using the tableau server.

Having interactive and dynamic possibilities in Tableau ofter requires performing calculations behind the scene.  Calculations can be performed either via table calculations or calculated fields allowing vizzes to be dynamic. Even though these calculations can be complex, it might be interesting to use Python under the hood. Python is a freely available programming language with a variety of open-source libraries. Python serves different purposes from web design to game development, but what we might be interested in is data manipulation in Python. Numpy and Pandas are libraries specifically designed for vectors, matrices, series and tables manipulations. Therewith, libraries for data science problems such as sklearn, tensorflow, lightgm and many others help data scientists, for example, to develop, test and validate their models.

Tableau gives you the possibility to link it to Python, run a script and update tableau vizzes dynamically. So, in this post, we will go over the simple steps of creating a bridge between Tableau and Python.


Assuming that a reader has Tableau already installed on the computer, one needs to install a statistical package Anaconda which includes Python with various preinstalled libraries.  On top of this, TabPy has to be installed, a key element that bridges Tableau and Python. In other words, TabPy is a server running in the background, and it provides an API between Tableau and Python. Let’s build this link in Windows 10 and Tableau version 2021.3.3:

  1. Install Anaconda following instructions here. During the installation, use default settings.
    • Find Anaconda Powershell Prompt (console) in your installed program
    • Make sure that Python is installed by typing in the console python -V. You should receive an installed python version as an output. In my case, it is  Python 3.8.8
  2. Install TabPy following instructions here. So, it takes only two steps:
    • Update Python libraries installer pip by typing in the console: python -m pip install --upgrade pip
    • Install TabPy:pip install tabpy
  3. Make sure that you run TabPy in the background by typing tabpy in the console.
  4.  In Tableau go to Help -> Settings and Performance -> Manage Analytics Extention Connection

python alteryx

5. In the pop-up menu, choose TabPy. Be default TabPy uses port # 9004. Input the Hostname and Port as below:

python alteryx

6. Press Test Connection. If it gives you a notification “Successfully connected to the analytics extension”. You are done, and you only need to Save this connection.

7. If it throws you an error, ensure that tabpy is running (step 3) and allow your firewall to operate through port 9004. To open the port in the firewall, you need to find Firewall & network protection settings. Go to the Windows settings and search for Firewall. Below find the Advanced settings link and press it. Allow to make changes in this app, and in the opened application, find Inbound rules on the top left corner. Then, press the bottom New Rule… Choose the Port option where you specify the local port 9004.

Now you are ready to run Python scripts in Tableau.


Linking Tableau and Python opens up new possibilities for Tableau developers and final users, allowing them to have a heavy moth under the hood. In the Part 2, we will go over an example where Tableau will be linked to Python via TabPy.


Boris Kushnarev
Author: Boris Kushnarev