Python
Insert custom Python code
Last updated
Was this helpful?
Insert custom Python code
Last updated
Was this helpful?
Code allows for custom Python to be executed against tables and objects inside a Cascade Workflow. One can ingest any number of sources and output any number of objects.
Any source linked to the Code tool is accessible using the sources
dictionary, and objects can be accessed by their index or by their name. For example:
Similarly, workflow variables are available using the variables
dictionary. It's recommended to access variables by their name:
Cascade allows the return of Table,
Chart
, Json
, or Markdown
objects for use in downstream tools. Objects can be returned as a single object or an array of objects.
To create and return a table, provide a name
and pandas df
attribute to the Table
object.
To create and return a chart, provide a name
and plotly figure
attribute to the Chart
object.
To create and return a json, provide a name
and python dict
attribute to the JSON
object.
To create and return a json, provide a name
and python dict
attribute to the JSON
object.
Within the Code tool, the following libraries are accessible by default. Import libraries using import
:
Library
Description
Import
Data manipulation
import pandas
API requests
import requests
JSON handling
import json
Numerical and statistical operations
import numpy
Regressions and machine learning
import sklearn
Time-series forecasting
from fbprophet import Prophet
Feature engineering
import featuretools
Machine learning
import evalml
Time series forecasting and classification
import sktime
Fuzzy matching for data cleaning
import fuzzymatcher
Fuzzy matching for data cleaning
import recordlinkage
API requests
import requests
Math and engineering
import scipy
Web scraping
import scrapy
Web scraping
from bs4 import BeautifulSoup
URLlib
URL Encoding/decoding
import urllib