Create a Script in a Data Flow
Insert a script operator to transform incoming data with a Python script and output structured data to the next operator.
Context
The script operator receives the data from a previous operator. You can provide transformation logic as a body of the transform function in the Script property of the operator. Incoming data is fed into the data parameter of the transform function and the result from this function is returned to the output.
The script operator allows data manipulation and vector operations by providing support for NumPy and Pandas modules. Non-I/O objects and functions of NumPy and Pandas can be used with aliases np and pd, respectively, without any requirements to explicitly import them.
The incoming data parameter in the transform function is of type Pandas DataFrame. The input table is converted into a DataFrame and fed into transform function as data parameter. You are expected to provide scripts for the intended transformation of the incoming DataFrame and also return a valid DataFrame from transform function. It is important that the returning DataFrame from the transform function has the same column names, types and order as the specified table for the output. Otherwise, execution of the data flow results in failure.