Can I run R in Python

Use R and Python scripts in the schema

Starting with version 2019.3.1, you can use R and Python scripts to perform more complex cleanup operations or to incorporate predictive modeling data into your schema. Data is passed from the flow as input via the R or Python script step and then returned as output data that you can further clean up using the features of Tableau Prep Builder.

Note: The connection to scripts as an input step for your schema is not yet supported. In addition, scripting steps for flows that have been created or published in Tableau Online are not yet supported.

Configure your Rserve server or Tableau Python server (TabPy) and add a script step to your schema. Tableau Prep passes the data to Rserve for R or to Tableau Python Server (TabPy) for Python and returns the resulting data to the schema in the form of a table. You can still apply cleaning operations to the results and generate your output for analysis.

When you create your script, you must include a function that takes a data frame as an argument to the function. If you want to get back fields other than those you entered, a getOutputSchema function must be included in the script that defines the output and data type. Otherwise, the output uses the fields from the input data.

If you are creating or editing schemas in Tableau Server (version 2020.4.1 and higher) that contain script steps, Tableau Server must also have a connection to an Rserve or TabPy server in order to run script steps. For information on how to configure R or Python for use in your schemas and how to create your scripts, see Use R (Rserve) scripts in your schema (Link opens in a new window) or Python scripts in the schema Use (Link opens in a new window).

Other articles in this section