Python integration with Tableau is one of the options that you have to improve your products and visualizations. This tutorial will show you how to integrate python into Tableau and how to create your own virtual environment so that you can use a specific python version and compatible libraries.
Tabpy Installation with a Virtual Environment
You will have to create and activate your tabpy virtual environment that uses the Python 3.7 version.
You can do this with the following commands:
Creating virtual environment named tabyenv
conda create -n tabyenv python=3.7 anaconda
Confirm the virtual environment creation by listing all virtual environments created.
Conda info -e
You will need to install tabpy library because this tool is the one that will allows you to link python libraries with the Tableau interface and commands. first you have to access or activate virtual environment in which Tabpy will be installed. Then, you only have to write the following command in your terminal to install Tabpy.
pip install tabpy
Activate virtual environment named Tabpy
Tabpy activation is confirmed by stating the command tabpy as it is shown in the image below
Testing your tableau connection with your Tabpy library
Secondly you have to connect Tableau with your virtual environment in which to installed Tabpy The procedure is shown below:
As you can see in the following video you can check how your Tabpy library is connected with the Tableau
Here is the procedure to get the tablaeu and tabpy connection
- Access you tableau desktop
- Click on the help menu at the right top corner
- Click on Settings and Performance
- Select Manage Service Connection
- Once the Select an External Service window is opened set the following specifications:
- In Select an External Service, select Tabpy-External API
- Choose localhost as the server
- Port type will be 9004 Finally, you can click on Test connection to confirm the connection between Tabpy and Tableau.
- Finally, you can click Test Connection to confirm the connection between Tabpy and Tableau.
We hope that you have found this tutorial easy to do start creating your own functions with Python and Tableau.