Skip to main content

API Task - Wrangle Output to Python


As of Release 9.7, Wrangle to Python conversion has been deprecated. For more information, please see End of Life and Deprecated Features.


EXPERIMENTAL FEATURE: This feature is intended for demonstration purposes only. This feature may be modified or removed from the Alteryx Analytics Cloud without warning in a future release. It should not be deployed in a production environment.


API access is migrating to Enterprise only. Beginning in Release 9.5, all new or renewed subscriptions have access to public API endpoints on the Enterprise product edition only. Existing customers on non-Enterprise editions will retain access their available endpoints (Legacy) until their subscription expires. To use API endpoints after renewal, you must upgrade to the Enterprise product edition or use a reduced set of endpoints (Current). For more information on differences between product editions in the new model, please visit Pricing and Packaging.

You can enable an API endpoint that converts the your recipe steps to generate a specific output into Python Pandas code. When executed, this generated Python Pandas code applies transformations to your specified dataset and generates the specified output.

Alpha Release

This endpoint is the beginning of enabling the Alteryx Analytics Cloud to integrate with pre-existing Python data pipelines.

This documentation provides information on how to explore the capabilities of the Alteryx Analytics Cloud to generate Python code for your external data pipelines.


To enable generation of Python Pandas code, please complete the following:


  1. You apply this change through the Workspace Settings Page. For more information, see Platform Configuration Methods.

  2. Locate the following setting and set it to Enabled:

    Wrangle to Python Conversion
  3. The feature is now enabled.


  • This endpoint does not currently support multi-dataset operations.

  • The generated Python code does not yield readable columns in the output code.

  • Conversion of Wrangle script to Python code is supported for CSV files only.

v4 OutputObjects WrangleToPython Create

This section contains reference documentation on the API endpoint. This endpoint method is applied to a specified outputObject. This outputObject is the result of execution of a specific recipe (wrangledDataset). That recipe has references to its source importedDatasets and connections.

For more information on supported versions of the APIs, see Designer Cloud Powered by Trifacta: API Reference docs.

This API enables generation of Python Pandas code for the Wrangle recipe associated with an output object.

Version: v4


Relevant terms:




An outputObject is a definition of one or more types of outputs and how they are generated. It must be associated with a recipe.


An outputObject must be created for a recipe before you can run a job on it. One and only one outputObject can be associated with a recipe.


A writeSettings object defines file-based outputs within an outputObject. Settings include path, format, compression, and delimiters.


A publications object is used to specify a table-based output and is associated with an outputObject. Settings include the connection to use, path, table type, and write action to apply.

Required Permissions


Each request to the Alteryx Analytics Cloud must include authentication credentials. See Designer Cloud Powered by Trifacta: API Reference docs.


Request Type: POST



Request URI - Example:


Request Body:

The following defines the running environment used for the outputObject.

    "execution": "spark"


Response Status Code - Success: 200 - OK

Response Body Example:

The generated response is the Python Pandas code:

from trifacta.transform_functions.function_definitions import Replace
import pandas as pd
import numpy as np

def run_transforms(df0=None):
  if (df0 is None):
    df0 = pd.read_csv('input.csv', skip_blank_lines=False, lineterminator='\n', dtype=str, encoding='UTF-8')
  replace1 = Replace('x', 'u', False, False)
  replace2 = Replace('x', 'u', True, False)
  replace3 = Replace('x', 'u', True, True)
  replace4 = Replace('x', '\\\\', True, False)
  df3 = pd.DataFrame({'new_column1': df0['col1'].apply((lambda x: replace1.exec(x))), 'new_column2': df0['col1'].apply((lambda x: replace2.exec(x))), 'new_column3': df0['col1'].apply((lambda x: replace3.exec(x))), 'new_column4': df0['col1'].apply((lambda x: replace4.exec(x)))})
  return df3


For more information , see Designer Cloud Powered by Trifacta: API Reference docs