Function Details

Python Function

This node allows you to run custom Python code.

Outputs

Your return statement should return a string. If you want to return a dictionary, you can use json.dumps(your_data_object) to convert it to a string. or if you want to return a dataframe, you can use df.to_json(orient='records') to convert it to a string.

There are a few things to keep in mind when using this node:

1. Using Inputs

While for most nodes we use the {{node_id}} syntax to access the output of a node, in the Python code you can access the inputs from a predefined dictionary called inputs.

For example:

text_input = inputs['text_input_12345']

2. Returning an Output

Only two constraints here:
- Your code must always end with a return statement

- The returned output should always be in string format, even if returning a dictionary

it must be converted to a string using

json.dumps(your_data_object) or if it's a Pandas dataframe you can use df.to_json(orient='records')


3. Available Imports

In this Runtime environment you have access to the following imports:

import csv
import os
import io
import re
import json
import requests
import numpy as np
from bs4 import BeautifulSoup

If you need more other library, please reach out!