Notes: |
|
The fields/icons on the RubiPython configuration page are described in the table below.
Icon/Field | Description |
Available Input Variables |
|
Custom Output Variables | It displays a list of output variables you created. These variables are stored in the form of a Dictionary. |
Add Custom Output Variable |
|
Clear Output Variables | It clears the created output variables. |
Refresh Output Variables | It refreshes the created output variables. |
Definite Option Output Variable |
|
Input Carry Forward Flag |
|
Input Same As Output |
|
Python Code Editor | The Python Code Editor helps you to add your customized Python code. Refer to Using Python Code Editor. |
Minimap |
|
Theme |
|
| It helps you to maximize the Code Editor page. |
It saves the changes, closes the configuration page, and returns you to the workbook canvas. |
In the Python Code Editor, you can add your Python code.
print2log()
.A sample Python code is shown in the image below.
The table below explains the above code snippet.
Line of Code | Result |
| It creates a copy of |
| It prints the contents of |
| It creates a new variable named ‘output’ of type dictionary. |
| It assigns the value of Sepal.Length of Iris CSV dataset multiplied by 2.54 to column |
Notes: |
|
A sample Python code to access predecessor tasks is shown in the image below.
The table below explains the above code snippet.
Line of Code | Result |
| It prints all the predecessor task names referenced by inputData to the console log or custom component log as a dictionary. |
| It prints the contents (predecessor task names, column names, and index) of inputData to the console log or custom component log. |
| It prints the contents (column names and index) of the predecessor task to the console log or custom component log. |
| It prints the contents (column name and index) of a particular column of the predecessor task to the console log or custom component log. |
To create custom variable in your RubiPython code, follow the steps given below.
Select the type of your output variable from the Variable Type drop-down. The options are Categorical, Numerical, Interval, and Textual.
Note: | Ensure the data type of the newly created output variable matches the data type of the corresponding input variable. If the variable types do not match, the application gives an error when running the algorithm flow. |
The output variable is created and is added to the Custom Output Variables list.
You can create multiple custom output variables by providing a JSON string.
To create multiple custom output variables in your RubiPython code, follow the steps given below.
Enter JSON strings in the following format –<Variable1 Name>, <Variable Type>, <Data Type>; <Variable2 Name>, <Variable Type>, <Data Type>; …<VariableN Name>, <Variable Type>, <Data Type>
.
Note: | Individual elements of the string should be separated by comma (,) and the strings should be separated by a semicolon (;). |
For example, to add the variables Name and Age of type Text and Integer respectively, the string would be – Name, Textual, Textual; Age, Numerical, Integer.
Click Validate to validate the string.
If the string is valid, a confirmation message is displayed. If the string is invalid, the application gives an error message. You can rectify the errors and try again.
After you make sure the string is valid, Click Create.
The specified output variables are created and are added to the Custom Output Variables list.
Notes: |
|