Numerical Functions
abs
abs(val)
Get the absolute value of a given number Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (float): The absolute value of the number Examples: abs(-2) -> 2.0 abs(INPUT_COL) -> 2.0
ceil
ceil(val)
Get the smallest integer greater than or equal to the given number Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (float): The smallest integer greater than or equal to the given number Examples: ceil(2.4) -> 3.0 ceil(INPUT_COL) -> 3.0
exp
exp(val)
Calculate e to the power of val (e^val) Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (float): e to the power of val Examples: exp(1) -> 2.71828 exp(INPUT_COL) -> e to the power of INPUT_COL val
factorial
factorial(val)
Calculate the factorial of a given number Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (int): The factorial of `val` Examples: factorial(3) -> 6 = 3! = (3 x 2 x 1) factorial(INPUT_COL) -> factorial of INPUT_COL value
float
float(val)
Cast a number or a string to a float value Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (float): The float value of the input Examples: float(2) -> 2.0 float('2.5') -> 2.0 float(INPUT_COL) -> float value of INPUT_COL
float_eq
float_eq(val0, val1)
Compare if two floating point numbers are equivalent Args: val0 (float): The first value to compare val1 (float): The second float value to compare Returns: Returns true if they are equal Examples: floateq(2.5, 2.5) -> true floateq(2.5, 2.4) -> false
floor
floor(val)
Largest integer less than or equal to the given number Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (float): The largest integer less than or equal to the given number Examples: floor(2.5) -> 2.0 floor('2.5') -> 2.0 floor(INPUT_COL) -> floor value of INPUT_COL
int
int(val)
Integer value of a given number Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (int): The integer value of the input Examples: int(2.5) -> 2 int('2.5') -> 2 int(INPUT_COL) -> int value of INPUT_COL
log
log(val, base=None)
Natural logarithm of the given number. Can optionally set a specific logarithmic base. Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes to take the logarithm of base (float): a number, a number as a single-quoted string, or a field name without quotes to use as a logarithmic base. Defaults to e. Returns: (float): The logarithm of the number in the given base (or natural logarithm) Examples: log(2.71828) -> 1.0 log('2.71828') -> 1.0 log(INPUT_COL) -> log value of INPUT_COL
log10
log10(val)
Base-10 logarithm of the given number Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (float): The base-10 logarithm of the given number Examples: log10(10) -> 1.0 log10('10') -> 1.0 log10(INPUT_COL) -> log10 value of INPUT_COL
number
number(val)
Float value of the given number Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (float): The input value as a number Examples: number('2.5') -> 2.5 number(INPUT_COL) -> float value of INPUT_COL
pow
pow(val, exp)
Calculate a number raised to a given power Args: val (str/int/float): the base value; represented as a number, a number as a single-quoted string, or a field name without quotes exp (str/int/float): the power to raise the base value to; represented as a number, a number as a single-quoted string, or a field name without quotes Returns: (float): The value of the base value raised to the given power Examples: pow(2, 3) -> 8.0 pow('2', 3) -> 8.0 pow(INPUT_COL, 3) -> 8.0
round
round(val, ndigits=None)
Round a given number Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes ndigits (str/int/float, optional): the number of digits after the decimal point to round to. Should have an integer value. Defaults to 0. Returns: (float): the rounded value of the given number Examples: round(2.7) -> 3.0 round(2.7, 1) -> 2.7 round(2.7, 2) -> 2.7 round(2.721112222, 2) -> 2.72
sqrt
sqrt(val)
Calculate the square root of a given number Args: val (str/int/float): a number, a number as a single-quoted string, or a field name without quotes Returns: (float): the square root of the number Examples: sqrt(9) -> 3.0
sum
sum(input_list)
Calculate the sum of several numerical values Args: input_list (list): a list of numerical values: either numbers (without quotes) or field names (without quotes) Returns: (float): the sum of the numerical values in the list Examples: sum([9, 10, 11]) -> 30.0
trunc
trunc(val)
Truncate a number to an integer Args: val (str): a valid number (with or without quotes) or a field name (without quotes) Returns: Returns a truncated value of a number Examples: trunc(2.5) -> 2 trunc('2.5') -> 2 trunc(INPUT_COL) -> truncate value of INPUT_COL