Tableau Conference TC17 Sneak Peek: Integrating Julia for Advanced Analytics

Using Julia within calculations in Tableau (click to enlarge)
Using Julia calculations within Tableau (click to enlarge)

We have already seen some love from Tableau for R and Python, boosting Tableau’s Advanced Analytics capabilities.

So what is the next big thing for our Data Science Rockstars? Julia!

Who is Julia?

JuliaJulia logo is a high-level dynamic programming language introduced in 2012. Designed to address the needs of high-performance numerical analysis its syntax is very similar to MATLAB. If you are used to MATLAB, you will be very quick to get on track with Julia.

Compared to R and Python, Julia is significantly faster (close to C and FORTRAN, see benchmark). Based on Tableau’s R integration, Julia is a fantastic addition to Tableau’s Advanced Analytics stack and to your data science toolbox.

Where can I learn more?

Do you want to learn more about Advanced Analytics and how to leverage Tableau with R, Python and Julia? Meet me at the 2017 Tableau Conferences in London, Berlin or Las Vegas and join my Advanced Analytics sessions:

Will there be an online tutorial?

Yes, of course! I published tutorials for R and Python on this blog. And I will also publish a Julia tutorial soon. Feel free to follow me on Twitter @xlth, and leave me your feedback/suggestions in the comment section below.

Further reading: Mastering Julia

A German translation of this post is published on the official Tableau blog: Tableau Conference On Tour Sneak Peek: Julia-Integration für Advanced Analytics

TabPy Tutorial: Integrating Python with Tableau for Advanced Analytics

TabPy allows Tableau to execute Python code on the fly
TabPy allows Tableau to execute Python code on the fly

In 2013 Tableau introduced the R Integration, the ability to call R scripts in calculated fields. This opened up possibilities such as K-means clustering, Random Forest models and sentiment analysis. With the release of Tableau 10.2, we can enjoy a new, fancy addition to this feature: the Python Integration through TabPy, the Tableau Python Server.

Python is a widely used general-purpose programming language, popular among academia and industry alike. It provides a wide variety of statistical and machine learning techniques, and is highly extensible. Together, Python and Tableau is the data science dream team to cover any organization’s data analysis needs.

In this tutorial I’m going to walk you through the installation and connecting Tableau with TabPy. I will also give you an example of calling a Python function from Tableau to calculate correlation coefficients for a trellis chart.

1. Install and start Python and TabPy

Start by clicking on the Clone or download button in the upper right corner of the TabPy repository page, downloading the zip file and extracting it.

TabPy download via GitHub web page

Protip: If you are familar with Git, you can download TabPy directly from the repository:

> git clone git://github.com/tableau/TabPy

TabPy download via Git command line interface

Within the TabPy directory, execute setup.sh (or setup.bat if you are on Windows). This script downloads and installs Python, TabPy and all necessary dependencies. After completion, TabPy is starting up and listens on port 9004.

2. Connecting Tableau to TabPy

In Tableau 10.2, a connection to TabPy can be added in Help > Settings and Performance > Manage External Service Connection:

Tableau main menu
Tableau main menu

Set port to 9004:

External Service Connection dialogue
External Service Connection dialogue

3. Adding Python code to a Calculated Field

You can invoke Calculated Field functions called SCRIPT_STR, SCRIPT_REAL, SCRIPT_BOOL, and SCRIPT_INT to embed your Python script in Tableau:

Python script within Tableau
Python script within Tableau

4. Use Calculated Field in Tableau

Now you can use your Python calculation as Calculated Field in your Tableau worksheet:

Tableau workbook featuring a Python calculation
Tableau workbook featuring a Python calculation

Feel free to download the Tableau Packaged Workbook (twbx) here.

[Update 3 Jan 2017]: Translated to Japanese by Tomohiro Iwahashi: Tableau + Python 連携 (Tabpy) を使ってみよう!

[Update 30 Mar 2017]: A German translation of this post is published on the official Tableau blog: TabPy Tutorial: Integration von Python mit Tableau für Advanced Analytics