Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.activeviam.com/llms.txt

Use this file to discover all available pages before exploring further.

On top of the functions listed below, measures can also be combined with mathematical operators.
  • The classic +, - and * operators:
    >>> df = pd.DataFrame(
    ...     columns=["City", "A", "B", "C", "D"],
    ...     data=[
    ...         ("Berlin", 15.0, 10.0, 10.1, 1.0),
    ...         ("London", 24.0, 16.0, 20.5, 3.14),
    ...         ("New York", -27.0, 15.0, 30.7, 10.0),
    ...         ("Paris", 0.0, 0.0, 0.0, 0.0),
    ...     ],
    ... )
    >>> table = session.read_pandas(df, keys={"City"}, table_name="Math")
    >>> cube = session.create_cube(table)
    >>> l, m = cube.levels, cube.measures
    >>> m["Sum"] = m["A.SUM"] + m["B.SUM"]
    >>> m["Subtract"] = m["A.SUM"] - m["B.SUM"]
    >>> m["Multiply"] = m["A.SUM"] * m["B.SUM"]
    >>> cube.query(
    ...     m["A.SUM"],
    ...     m["B.SUM"],
    ...     m["Sum"],
    ...     m["Subtract"],
    ...     m["Multiply"],
    ...     levels=[l["City"]],
    ... )
               A.SUM  B.SUM     Sum Subtract Multiply
    City
    Berlin     15.00  10.00   25.00     5.00   150.00
    London     24.00  16.00   40.00     8.00   384.00
    New York  -27.00  15.00  -12.00   -42.00  -405.00
    Paris        .00    .00     .00      .00      .00
    
  • The float division / and integer division //:
    >>> m["Float division"] = m["A.SUM"] / m["B.SUM"]
    >>> m["Int division"] = m["A.SUM"] // m["B.SUM"]
    >>> cube.query(
    ...     m["A.SUM"],
    ...     m["B.SUM"],
    ...     m["Float division"],
    ...     m["Int division"],
    ...     levels=[l["City"]],
    ... )
               A.SUM  B.SUM Float division Int division
    City
    Berlin     15.00  10.00           1.50         1.00
    London     24.00  16.00           1.50         1.00
    New York  -27.00  15.00          -1.80        -2.00
    Paris        .00    .00            NaN          NaN
    
  • The exponentiation **:
    >>> m["a²"] = m["A.SUM"] ** 2
    >>> cube.query(m["A.SUM"], m["a²"], levels=[l["City"]])
               A.SUM      a²
    City
    Berlin     15.00  225.00
    London     24.00  576.00
    New York  -27.00  729.00
    Paris        .00     .00
    
  • The modulo %:
    >>> m["Modulo"] = m["A.SUM"] % m["B.SUM"]
    >>> cube.query(m["A.SUM"], m["B.SUM"], m["Modulo"], levels=[l["City"]])
               A.SUM  B.SUM Modulo
    City
    Berlin     15.00  10.00   5.00
    London     24.00  16.00   8.00
    New York  -27.00  15.00   3.00
    Paris        .00    .00    NaN
    
absReturn a measure equal to the absolute value of the passed measure.
ceilReturn a measure equal to the smallest integer that is >= to the passed measure.
cosReturn a measure equal to the cosine of the passed measure in radians.
erfReturn the error function of the input measure.
erfcReturn the complementary error function of the input measure.
expReturn a measure equal to the exponential value of the passed measure.
floorReturn a measure equal to the largest integer <= to the passed measure.
isnanReturn a measure equal to True when the passed measure is NaN and to False otherwise.
logReturn a measure equal to the natural logarithm (base e) of the passed measure.
log10Return a measure equal to the base 10 logarithm of the passed measure.
maxReturn a measure equal to the maximum of the passed arguments.
minReturn a measure equal to the minimum of the passed arguments.
roundReturn a measure equal to the closest integer to the passed measure.
sinReturn a measure equal to the sine of the passed measure in radians.
sqrtReturn a measure equal to the square root of the passed measure.
tanReturn a measure equal to the tangent of the passed measure in radians.