What is a Python Code node?

Python Code node

The Python Code node allows you to run Python code in your flow. You can use this node to perform complex operations that are not available in the other nodes. You can receive one or several inputs from previously connected nodes, and use the output of the Python Code node in the following nodes.

The Python node has pre-imported a few libraries for you to use, here is a non-exhaustive list:

  • import json
  • import pandas as pd
  • import io
  • import requests
  • import tiktoken
  • from fuzzywuzzy import fuzz
  • from tabulate import tabulate
  • import datetime
  • import sklearn
  • import aiohttp
  • import matplotlib.pyplot as plt
  • import seaborn as sns
  • import asyncio
  • import base64
  • import time
  • import re
  • import random
  • import numpy as np
  • import plotly.express as px
  • import plotly.graph_objects as go
  • import weaviate

If you are missing a library, please, let us know, so that we can review your request.

How to use it?

  • Create a project and add a Python Code node.
  • Connect the Python Code node to the desired input.
  • Open the node settings and write the Python code. You can use the inputs connected to the node referencing them with the id, for example, in_0.
  • Anything written in the output variable will be sent as the Python node’s output to its children nodes.
  • Run the flow and check the output.