Tableau Prep Tabpy

broken image


How to set up TabPy in Tableau

  1. Tabpy Download
  2. Tableau Server Tabpy
  3. Tableau Prep Tabpy

1. Install Python on your machine (or server)

A popular and easy way of doing it would be to through downloading and installing Anaconda.

2. Download TabPy server

Now we need to get the TabPy module. You can do this by downloading it through GitHub or by opening up Anaconda prompt on your machine and typing and running:

Execute Python code on the fly and display results in Tableau visualizations: View the Project on GitHub tableau/TabPy. TabPy (the Tableau Python Server) is an Analytics Extension implementation which expands Tableau's capabilities by allowing users to execute Python scripts and saved functions via Tableau's table calculations.

Update, 25th March 2020: As of Tableau 2020.1, TabPy is now fully supported by Tableau and has an easier installation process, as well as some pre-built statistical functions for easy use in Tableau (or anywhere else!) and other enhancements. Install TabPy using pip – simply a case of typing pip install tabpy in your command line. Tableau Prep Builder uses TabPy to pass data from your flow through TabPy as the input, applies your script, then returns the results back to the flow. Run pip3 install pandas. You must use a pandas data frame in your scripts to integrate with Tableau Prep Builder. Configure the Tableau Python (TabPy) server for Tableau Server. Assuming you already have Tableau Prep = 2019.3.1 installed, follow the instructions on the TabPy github site to set up TabPy. How does Prep work with Python? The author of a Tableau Prep flow adds a script step, then configures the settings of that step to point to the TabPy server, open the appropriate.py file, and call the appropriate. Tableau Prep Builder uses TabPy to pass data from your flow through TabPy as the input, applies your script, then returns the results back to the flow.

pip installtabpy

Note that there is also a package on the conda repository, which you could install as shown below but that is an old way of doing it.

conda install -c anaconda tabpy-server

You then type y and hit enter when it asks if you want to proceed.
Here is how that looks like.

3. Start TabPy server

If you downloaded TabPy using pip install tabpy(recommended way) then all you have to do to start the server is type and run:

Prep

tabpy

in your Anaconda prompt or other terminal where you used pip install tabpy earlier.

If you downloaded TabPy from GitHub and put it on your desktop you can get the address of your folder by clicking on the name like so:

Tableau Prep Tabpy

tabpy

in your Anaconda prompt or other terminal where you used pip install tabpy earlier.

If you downloaded TabPy from GitHub and put it on your desktop you can get the address of your folder by clicking on the name like so:

Then in Anaconda promt you would want to type cd (cd is short for change directory) then your location and hit enter.

cd C:UsersAlexanderDesktopTabPy

Finally would want to type startup.cmd and hit enter.

Tabpy Download

Now it should be ready to run and look like this:

Tableau Server Tabpy

You can now minimize this window but don't close it until you're finished using TabPy in Tableau.

If you downloaded TabPy using Anaconda you can type and hit enter:

cd C:Users*your user name*Anaconda3pkgstabpy-server-0.2-py37_1Libsite-packagestabpy_server

Finally you would want to type startup.bat and hit enter.

Now it should be ready to run and look like this:

4. Connect TabPy Server to Tableau Desktop

In Tableau go to:
Help > Settings and Performance > Manage External Connection
Select TabPy
Select Localhost
Make sure the port is 9004

Tableau Prep Tabpy

If when you click 'Test Connection' you get the message 'Successfully connected to the external service.' then congratulations! You are ready to use Python in Tableau.

If you run into any issues, looking at the official documentation would be helpful: tableau.github.io/TabPy/

If you need more guidance or don't want to deal with this yourself, then by all means get in touch with us





broken image