Alteryx, as a platform integrating data analysis, data science and process automation, has many great advantages such as GUI, no code and can implement complex data process quickly and straight.

However, sometimes advantage can be disadvantage. Fully graphic process not only maximize the visualization but also limit users to customize the functions. In a nutshell, users have to follow the rules defined by developers of Alteryx, which sometimes may not fit our cases. Fortunately, Alteryx allows user to embed Python in workflow so that we can customize any tools we need.

Today I will introduce the most basic functions of Python in Alteryx, including import Alteryx package, input and output data. Below it is today’s workflow:

We input a dataset called ‘Test’ and simply connect it to a Python tool in Alteryx. To start the coding, the first code will always be ‘from ayx import Alteryx’.

This is to enable the methods of Alteryx. Now it is time to input the data. Unlike other tools, Python can not distinguish input automatically. Below is the code to configure input:

We use to input the data, the parameter is name of link. Similarly, we also need to manually configure the anchor for output. The Python tool can be configured up to 5 output. Below is the code to configure input:

Alteryx.write() is used to output data. The first parameter is name of data and the second parameter is the number of output anchors.

Now you already know how to input and output data by Python in Alteryx, in the coming blogs I will introduce more complex methods and functions regarding Python.

Chen Zhang
Author: Chen Zhang