atoti.array.mean module#

atoti.array.mean(value: ArrayType, /) JavaFunctionOperation#
atoti.array.mean(value: MeasureDescription, /) MeasureDescription

Return a measure equal to the mean of all the elements of the passed array measure.

Example

>>> pnl_table = session.read_csv(
...     f"{RESOURCES}/pnl.csv",
...     array_separator=";",
...     keys=["Continent", "Country"],
...     table_name="PnL",
... )
>>> cube = session.create_cube(pnl_table)
>>> l, m = cube.levels, cube.measures
>>> m["Mean"] = tt.array.mean(m["PnL.SUM"])
>>> m["Empty mean"] = tt.array.mean(m["PnL.SUM"][0:0])
>>> cube.query(m["PnL.SUM"], m["Mean"], m["Empty mean"])
                          PnL.SUM    Mean Empty mean
0  doubleVector[10]{-20.163, ...}  -30.83        .00
Return type

Union[MeasureDescription, JavaFunctionOperation]