Skip to Content

Python Functions

These are example Python functions you can use as a starting point for developing your own code. Please be aware that these functions are not rigorously tested, so they should NOT be used for production purposes without further validation. They are provided purely as examples with no representation or warranty of any kind.

If there is a function you’d like to see an example of, please email us.

Data

FunctionDescription
BASIC_CHARTGenerates a matplotlib chart from 2D numeric data and returns a PNG image as a base64 string.
EXCHANGE_RATERetrieves the exchange rate from a base currency to a target currency using a public API.
INTERNET_CSVFetches a CSV file from the internet (with CORS proxy) and returns its contents as a 2D list.
ONEDRIVE_CSVRetrieves a CSV file from the user’s Microsoft OneDrive App Folder using the Microsoft Graph API and a global variable graphToken for authentication. Returns the CSV contents as a 2D list, suitable for use in Excel.
SALESFORCE_APISRetrieves available Salesforce REST APIs and returns them as a 2D list.
WORDCLOUDGenerates a word cloud image from provided text data and returns a PNG image as a base64 string.

Engineering

FunctionDescription
PSYCHROMETRICSPerform core psychrometric calculations: wet bulb, dew point, humidity ratio, enthalpy.
STRUCTURAL_FEAPerforms 3D finite element analysis using the Pynite package and returns support reactions. This function is provided as an example only without any representation or warranty of correctness. DO NOT rely on for production use without your own testing and validation.

Financial

FunctionDescription
BLACK_SCHOLESCalculate the Black-Scholes price for a European call or put option.
PORTFOLIO_REBALANCERTax-efficient rebalancing of assets across Taxable, Roth, and Traditional accounts.
STOCK_PRICERetrieves the latest daily closing price for a given stock symbol using the Alpha Vantage API.

Fluids

FunctionDescription
AIRMASSCalculate the mass of air per square meter in the atmosphere along a given angle using a density profile.
ARCHIMEDESCalculate the Archimedes number (Ar) for a fluid and particle.
ATMOSPHERE_1976Calculate standard atmospheric properties at a given altitude using the US Standard Atmosphere 1976 model.
ATMOSPHERE_NRLMSISE00Compute temperature, density, and pressure using the NRLMSISE-00 atmospheric model.
BEJANCompute the Bejan number (length-based or permeability-based) using fluids.core library.
BOILINGCalculate the Boiling number (Bg), a dimensionless number for boiling heat transfer.
BONDCalculate the Bond number (Bo), a dimensionless number comparing gravitational and surface tension forces.
CAPILLARYCalculate the Capillary number (Ca) for a fluid system.
CAVITATIONCalculate the Cavitation number (Ca) for a flowing fluid.
CONFINEMENTCalculate the Confinement number (Co) for two-phase flow in a channel.
DEANCalculate the Dean number (De) for flow in a curved pipe or channel.
DRAGCalculate the drag coefficient (dimensionless) for an object in a fluid.
ECKERTCalculate the Eckert number (Ec) for a given velocity, heat capacity, and temperature difference.
EULERCalculate the Euler number (Eu) for a fluid flow.
FOURIER_HEATCalculate the Fourier number for heat transfer.
FOURIER_MASSCalculate the Fourier number for mass transfer (Fo).
FROUDECalculate the Froude number (Fr) for a given velocity, length, and gravity.

Optimization

FunctionDescription
BASIN_HOPPINGFinds the global minimum of a single-variable function using the basinhopping algorithm.
HESSIAN_MATRIXComputes the HESSIAN_MATRIX matrix (second derivatives) of a scalar function with respect to its variables.
JACOBIAN_MATRIXCalculate the JACOBIAN_MATRIX matrix of a mathematical expression with respect to specified variables.
LEAST_SQUARESSolve a nonlinear least-squares problem by fitting a user-defined model to data.
LINEAR_ASSIGNMENTSolves the linear assignment problem (Hungarian algorithm) for a given cost matrix.
LINEAR_PROGSolves a linear programming problem using scipy.optimize.linprog.
MINIMIZE_MULTIVARIATEMinimizes a multivariate function using scipy.optimize.minimize.
MINIMIZE_SCALARMinimizes a scalar function using scipy.optimize.minimize_scalar.
QUADRATIC_ASSIGNMENTSolves the quadratic assignment problem (QAP) for given flow and distance matrices.
ROOT_SOLVERSolves a square system of nonlinear equations using SciPy’s root-finding capabilities.
SENSITIVITY_MATRIXComputes the sensitivity matrix of a model output with respect to parameters using CasADi.

Statistical

FunctionDescription
HIERARCHICAL_CLUSTERPerforms hierarchical (agglomerative) clustering on numeric data and returns a dendrogram as a base64-encoded PNG image or an error message.
ONEWAY_ANOVAPerforms a one-way ANOVA test to compare the means of two or three independent groups.
VAL_DISCRETESelect a value from a list based on a discrete probability distribution.

Text

FunctionDescription
AI_ASKGenerate a text response using an AI model based on a prompt and optional tabular data.
AI_CHOICEUses AI to select the most appropriate choice from a list of options based on the given context.
AI_EXTRACTUses an AI model to extract specific types of information from unstructured text.
AI_FILLFills missing or incomplete data in a target range by learning patterns from an example range using a large language model.
AI_FORMATUses an AI model to format text according to a specific structure or pattern.
AI_LISTGenerate a list of items using an AI model based on a prompt and optional context values.
AI_TABLEUses an AI model to generate a structured table (2D list) based on a prompt, with optional header and source data.
TEXT_DISTANCECalculate text similarity scores between lookup_value(s) and lookup_array items using the specified algorithm.
VADER_SENTIMENTAnalyze sentiment of text using VADER.

Web

FunctionDescription
JINA_READERReturns web page content in markdown format using Jina. Useful as a starting point for extraction, summarization, etc.
Last updated on