atoti.array.sort module

atoti.array.sort(measure, *, ascending=True)

Return an array measure with the elements of the passed array measure sorted.

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["Sorted ascendingly"] = tt.array.sort(m["PnL.SUM"])
>>> m["Sorted descendingly"] = tt.array.sort(m["PnL.SUM"], ascending=False)
>>> cube.query(m["PnL.SUM"], m["Sorted ascendingly"], m["Sorted descendingly"])
                          PnL.SUM                          Sorted ascendingly                       Sorted descendingly
0  doubleVector[10]{-20.163, ...}  doubleVector[10]{-110.09900000000002, ...}  doubleVector[10]{9.259999999999998, ...}
Return type

MeasureDescription