atoti.agg.square_sum module#

atoti.agg.square_sum(operand: ColumnOrOperationOrLevel, /) MeasureDescription#
atoti.agg.square_sum(operand: MeasureDescription, /, *, scope: Scope) MeasureDescription

Return a measure equal to the sum of the square of the passed measure across the specified scope.

Parameters

Example

>>> df = pd.DataFrame(
...     columns=["id", "Quantity", "Price", "Other"],
...     data=[
...         ("a1", 100, 12.5, 1),
...         ("a2", 10, 43, 2),
...         ("a3", 1000, 25.9, 2),
...     ],
... )
>>> table = session.read_pandas(
...     df,
...     table_name="Product",
...     keys=["id"],
... )
>>> table.head().sort_index()
    Quantity  Price  Other
id
a1       100   12.5      1
a2        10   43.0      2
a3      1000   25.9      2
>>> cube = session.create_cube(table)
>>> m = cube.measures
>>> m["Other.SQUARE_SUM"] = tt.agg.square_sum(table["Other"])
>>> cube.query(m["Other.SQUARE_SUM"])
  Other.SQUARE_SUM
0                9
Return type

MeasureDescription