Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon

Interactive, notebook-style analysis in Tableau for data science extensibility from What's New

Save for later
  • 4 min read
  • 12 Oct 2020

article-image

Tanna Solberg
October 12, 2020 - 8:40pm

October 13, 2020

interactive-notebook-style-analysis-in-tableau-for-data-science-extensibility-from-whats-new-img-1

Tableau's intuitive drag and drop interface is one of the key reasons it has become the de facto standard for data visualization. With its easy-to-use interface, not only analysts, but everyone can see and understand their data. But let's look at who mean when we say "everyone." Does this include sophisticated users like data scientists or statisticians? In short, yes, but their workflow is slightly different; they rely heavily on statistical and machine learning algorithms, usually only accessible from R, Python, or Matlab. To interact with these libraries, statisticians and data scientists have to write code, experiment with their model parameters, and visualize the results. The usual tool of choice for data scientists is some notebook environment—such as RStudio or Jupyter—where they can mix their code and the visualizations.

interactive-notebook-style-analysis-in-tableau-for-data-science-extensibility-from-whats-new-img-2

Figure 1: The traditional Jupyter notebook environment

In the past, the number one reason for the lower adoption of Tableau for data scientists was the lack of support of this code-driven, iterative development methodology. However, with the Dashboard Extensions API and the Analytics Extensions API things have changed. The platform for everyone offers the best from code-driven data science and easy-to-use, drag-and-drop visualization worlds.

Tableau Python and R Integration

Analytical Extension presents the standard way to use Python, R, Matlab and other platforms' libraries and functions in Tableau workbooks. With standard SCRIPT Tableau functions, users can add their Python or R codes as Tableau calculated fields, opening up a whole new world in data enrichment and analysis.

interactive-notebook-style-analysis-in-tableau-for-data-science-extensibility-from-whats-new-img-3

 

Figure 2: A simple example of a Python calculated field in Tableau Desktop

While it's a convenient way to use existing calculations, this is not the same iterative experience as a notebook. Here comes the Dashboard Extensions API to the rescue, providing the user experience to work with the code in a code editor—while seeing the results immediately as Tableau charts.

CodePad editor for Tableau

The Tableau Extension Gallery was recently updated with a new extension that allows interaction with your code—just like you would have in a notebook. As you change the code in the code editor, Tableau executes it and recalculates the marks and updates the visualization before your very eyes.

interactive-notebook-style-analysis-in-tableau-for-data-science-extensibility-from-whats-new-img-4

Figure 3: Updating your viz with code editor extension CodePad

To use the extension, you need to create a string parameter and create a SCRIPT based calculated field with the relevant fields mapped as script parameters.

Unlock access to the largest independent learning library in Tech for FREE!
Get unlimited access to 7500+ expert-authored eBooks and video courses covering every tech area you can think of.
Renews at $19.99/month. Cancel anytime

interactive-notebook-style-analysis-in-tableau-for-data-science-extensibility-from-whats-new-img-5

Figure 4: Create a parameter to store the program code

interactive-notebook-style-analysis-in-tableau-for-data-science-extensibility-from-whats-new-img-6

Figure 5: Use parameter in SCRIPT function

Then add the extension to your dashboard, select the previously created parameter, and choose the same programming language configured to what you have in the Analytics Extension API:

interactive-notebook-style-analysis-in-tableau-for-data-science-extensibility-from-whats-new-img-7

Figure 6: Add and configure the CodePad extension to your dashboard

Now you can start building your views, adding to your machine learning models and use external APIs to enrich the data—all from the same platform. The best part is that you can reuse the same workbook to share the analysis with end users, which could potentially be placed on a different worksheet.

Sample workbook analysis in Tableau

To show some of real-life use cases, we put together an example workbook with three Python-based algorithms:

  1. Clustering - The clustering dashboard uses scikit learn’s DBSCAN algorithm to apply clustering to a set of points. interactive-notebook-style-analysis-in-tableau-for-data-science-extensibility-from-whats-new-img-8
    Figure 7: Clustering using DBSCAN algorithm
  2. Seasonality Analysis – Use statsmodel’s seasonal_decompose to remove seasonality from time series data and show the pure trends.
  3. Sentiment Analysis – Compare the titles and ratings of product reviews with their sentiment scores. interactive-notebook-style-analysis-in-tableau-for-data-science-extensibility-from-whats-new-img-9
Figure 8: Sentiment analysis using ntlk or textblob

 

Excited to try out this interactive, notebook-style analysis in Tableau? Download the demo workbook and add the extension to the dashboard.

If you want to learn more about the Dashboard Extensions and Analytics Extensions API, you can join the Tableau Developer program for additional resources and community interaction.