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
Function | Description |
---|---|
BASIC_CHART | Generates a matplotlib chart from 2D numeric data and returns a PNG image as a base64 string. |
EXCHANGE_RATE | Retrieves the exchange rate from a base currency to a target currency using a public API. |
INTERNET_CSV | Fetches a CSV file from the internet (with CORS proxy) and returns its contents as a 2D list. |
ONEDRIVE_CSV | Retrieves 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_APIS | Retrieves available Salesforce REST APIs and returns them as a 2D list. |
WORDCLOUD | Generates a word cloud image from provided text data and returns a PNG image as a base64 string. |
Engineering
Function | Description |
---|---|
PSYCHROMETRICS | Perform core psychrometric calculations: wet bulb, dew point, humidity ratio, enthalpy. |
STRUCTURAL_FEA | Performs 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
Function | Description |
---|---|
BLACK_SCHOLES | Calculate the Black-Scholes price for a European call or put option. |
PORTFOLIO_REBALANCER | Tax-efficient rebalancing of assets across Taxable, Roth, and Traditional accounts. |
STOCK_PRICE | Retrieves the latest daily closing price for a given stock symbol using the Alpha Vantage API. |
Fluids
Function | Description |
---|---|
AIRMASS | Calculate the mass of air per square meter in the atmosphere along a given angle using a density profile. |
ARCHIMEDES | Calculate the Archimedes number (Ar) for a fluid and particle. |
ATMOSPHERE_1976 | Calculate standard atmospheric properties at a given altitude using the US Standard Atmosphere 1976 model. |
ATMOSPHERE_NRLMSISE00 | Compute temperature, density, and pressure using the NRLMSISE-00 atmospheric model. |
BEJAN | Compute the Bejan number (length-based or permeability-based) using fluids.core library. |
BOILING | Calculate the Boiling number (Bg), a dimensionless number for boiling heat transfer. |
BOND | Calculate the Bond number (Bo), a dimensionless number comparing gravitational and surface tension forces. |
CAPILLARY | Calculate the Capillary number (Ca) for a fluid system. |
CAVITATION | Calculate the Cavitation number (Ca) for a flowing fluid. |
CONFINEMENT | Calculate the Confinement number (Co) for two-phase flow in a channel. |
DEAN | Calculate the Dean number (De) for flow in a curved pipe or channel. |
DRAG | Calculate the drag coefficient (dimensionless) for an object in a fluid. |
ECKERT | Calculate the Eckert number (Ec) for a given velocity, heat capacity, and temperature difference. |
EULER | Calculate the Euler number (Eu) for a fluid flow. |
FOURIER_HEAT | Calculate the Fourier number for heat transfer. |
FOURIER_MASS | Calculate the Fourier number for mass transfer (Fo). |
FROUDE | Calculate the Froude number (Fr) for a given velocity, length, and gravity. |
Optimization
Function | Description |
---|---|
BASIN_HOPPING | Finds the global minimum of a single-variable function using the basinhopping algorithm. |
HESSIAN_MATRIX | Computes the HESSIAN_MATRIX matrix (second derivatives) of a scalar function with respect to its variables. |
JACOBIAN_MATRIX | Calculate the JACOBIAN_MATRIX matrix of a mathematical expression with respect to specified variables. |
LEAST_SQUARES | Solve a nonlinear least-squares problem by fitting a user-defined model to data. |
LINEAR_ASSIGNMENT | Solves the linear assignment problem (Hungarian algorithm) for a given cost matrix. |
LINEAR_PROG | Solves a linear programming problem using scipy.optimize.linprog. |
MINIMIZE_MULTIVARIATE | Minimizes a multivariate function using scipy.optimize.minimize. |
MINIMIZE_SCALAR | Minimizes a scalar function using scipy.optimize.minimize_scalar. |
QUADRATIC_ASSIGNMENT | Solves the quadratic assignment problem (QAP) for given flow and distance matrices. |
ROOT_SOLVER | Solves a square system of nonlinear equations using SciPy’s root-finding capabilities. |
SENSITIVITY_MATRIX | Computes the sensitivity matrix of a model output with respect to parameters using CasADi. |
Statistical
Function | Description |
---|---|
HIERARCHICAL_CLUSTER | Performs hierarchical (agglomerative) clustering on numeric data and returns a dendrogram as a base64-encoded PNG image or an error message. |
ONEWAY_ANOVA | Performs a one-way ANOVA test to compare the means of two or three independent groups. |
VAL_DISCRETE | Select a value from a list based on a discrete probability distribution. |
Text
Function | Description |
---|---|
AI_ASK | Generate a text response using an AI model based on a prompt and optional tabular data. |
AI_CHOICE | Uses AI to select the most appropriate choice from a list of options based on the given context. |
AI_EXTRACT | Uses an AI model to extract specific types of information from unstructured text. |
AI_FILL | Fills missing or incomplete data in a target range by learning patterns from an example range using a large language model. |
AI_FORMAT | Uses an AI model to format text according to a specific structure or pattern. |
AI_LIST | Generate a list of items using an AI model based on a prompt and optional context values. |
AI_TABLE | Uses an AI model to generate a structured table (2D list) based on a prompt, with optional header and source data. |
TEXT_DISTANCE | Calculate text similarity scores between lookup_value(s) and lookup_array items using the specified algorithm. |
VADER_SENTIMENT | Analyze sentiment of text using VADER. |
Web
Function | Description |
---|---|
JINA_READER | Returns web page content in markdown format using Jina. Useful as a starting point for extraction, summarization, etc. |
Last updated on