Integration of Tableau with Python (TabPy) – Part 1

Part 1 – Connection Setup


1. The Necessity of Integration


As per the Gartner 2020 magic quadrant, Tableau is one of the leaders in visualization. Data Scientists use Tableau to explore the data quickly and get valuable insights into the data. Tableau also provides analytical functions like forecasting, clustering, trend lines, etc.



Python, on the other hand, is the go-to language for machine learning. Python enables the design, development, tuning, and deployment of machine learning models. Hence the integration of Tableau and Python facilitates the combination of the impactful visualization with complex model development.


2. Connection Setup


Prerequisites: Tableau Desktop (Tableau Public does not support integration with Python) and Python(Anaconda) installed on your system

TabPy (The Tableau Python Server) Analytics extension enables connecting Tableau with Python. It enables executing python scripts and visualizing the output within Tableau. You can either follow the video for setup or the steps mentioned below.

Tableau and Python (TabPy) Integration

The connection requires three steps as below:

Step 1. Install TabPy using the command below:

pip install tabpy


Step 2. Start TabPy server with the command below:

tabpy


Step 3. Connect Tableau to TabPy from the Tableau Desktop as below:

Start Tableau and Click on Help -> Settings and Performance -> Manage Analytics Extension Connection



An Analytics Extension Connection Window will open. Select the Analytics Extension as Tabpy/External API. Enter the server name as localhost and the Port as 9004 (This port would be the one you select while starting the TabPy server from Anaconda console/Terminal). After setting the fields as shown below, click on Test Connection.



If the connection is successful, you will get a message box confirming the same as below.



However, if the Python TabPy server is not running or terminated, you will get an error message as below. To resolve this error, verify whether the TabPy server is running and the port name of the connection is correct.



Once you have established the connection between Tableau and Python, you are ready to proceed towards Part 2 of this blog. You can navigate to the Part 2 by clicking here.


Leave a comment