Tableau Charting with Python and Jupyter Notebooks


A blog about how to create charts with python and jupyter notebooks. The posts are organized by the following topics:

By publishing the various posts on this site, I hope to share my experience and provide a helpful resource for others who are interested in learning more about Python, Jupyter Notebooks, and Tableau.

Recently, I wrote a blog about creating charts with python and Jupyter Notebooks. If you are interested in reading more on the subject, I recommend the following links:

– Tableau’s official docs on writing python scripts to generate charts

– This Twitter thread on how to use matplotlib with Jupyter Notebooks

– This article on how to use seaborn with Jupyter Notebooks

If you have any questions or comments, please feel free to reach out!

When I first discovered the Tableau JavaScript API, I knew it was going to be a huge help in getting data into Tableau. After all, Python is one of the most popular programming languages in the world and a very simple one too (at least for non-programmers!). As a developer at Tableau, I had a nice cup of coffee with my boss and he asked me something that I had never considered: “Why don’t you try using Python with Jupyter Notebooks?”

At first I wasn’t sure what he meant. Why would I need Python to create charts? Then it hit me: there are a lot of good reasons why you might want to use Python to create charts. For example, if you have data from an Excel spreadsheet, you could use Python to convert that data into an HTML table, which then could be used by Tableau to make charts. If you have data from an Excel spreadsheet that contains numbers and text, you could use Python to convert that data into an HTML table, which then could be used by Tableau to make charts.

Tableau Charting with Python and Jupyter Notebooks

At Tableau, we’re big fans of using Jupyter Notebooks for data science. We’ve been spending a lot of time driving toward better integration between the two products. One big area of focus is the ability to use Python in Tableau calculations. In this post, I’ll talk about the latest release of TabPy (0.11), an integration with Tableau that enables evaluation of Python code from inside a Tableau workbook.

In order to evaluate code inside a Tableau workbook, you have to have a server where your code is being executed. This can be on your local machine or on a remote server (e.g., AWS). The TabPy client allows you to send requests to the server and get results back in your workbook, just as if you were calling any other Tableau function:

You can access TabPy using JavaScript APIs (to integrate into custom web apps) or through the TabPy REST API, which returns JSON data that’s easily integrated into any application.

In addition to code execution, TabPy also provides two new table calculations:

SCRIPT_REAL()

SCRIPT_BOOL()

Creating Charts Using Python and Tableau

Posted by Alex Alsup on April 15, 2019

Recently I was asked to explore the potential for Python to replace our existing data preparation scripts, which were written in a combination of R, Perl and Bash. One of the requirements of the project was that charts would be created using Tableau. This would require Python to pass data into a Tableau charting routine.

I began by creating a Jupyter notebook and installing the TabPy server. This gave me a good idea of what would be involved in creating charts using Python. The next step was to investigate the use of Jupyter notebooks with Tableau.

In the last two posts, I have been exploring how Python can be utilized for extracting and visualizing stock market data. First, I looked at resampling time series data using pandas. Then, I explored a number of charting techniques offered by Tableau Software. This week, I will use Python to explore charting techniques with matplotlib and seaborn.

At work we use Tableau as our primary visualization tool. But as a supplement to Tableau, we also utilize Python for exploratory analyses and visualizations. As a result, we are often looking for ways to combine Python and Tableau into one coherent workflow. In this post, I will illustrate how to use Python to create charts in Jupyter Notebooks – which can then be published or embedded directly into Tableau dashboards.

To accomplish this task, we will utilize the following libraries:

pandas

numpy

matplotlib

seaborn

This is a quick follow up to my post on Tableau and Jupyter notebooks (and their integration). I recently got a new toy to play with – a smart doorbell. It has an app, but the app is not so great. It lets you see who is at the door, but it doesn’t allow you to store images, or do any kind of video analytics. In fact, there are no analytics at all. All it does is take pictures and give them to you. The device also has an API that allows you to get all the data/images from it.

I have been playing with the API for a few months now, learning about Jupyter notebooks and Pandas dataframes. The result is this blog post. Not only did I finally get around to writing something here, I also learned some cool stuff along the way.

The Doorbell sends me images when someone rings the doorbell or when motion is detected while someone is at the door (like a package delivery person). The first thing I wanted to know was how often people come to my door in general? Is it as often as I think? Or am I just home more often than usual?


Leave a Reply

Your email address will not be published. Required fields are marked *