atoti.array.n_lowest()#

atoti.array.n_lowest(measure, /, n)#

Return an array measure containing the n lowest elements of the passed array measure.

The values in the returned array are not sorted, use atoti.array.sort() to sort them.

Example

>>> pnl_table = session.read_csv(
...     TEST_RESOURCES_PATH / "csv" / "pnl.csv",
...     array_separator=";",
...     keys={"Continent", "Country"},
...     table_name="PnL",
... )
>>> cube = session.create_cube(pnl_table)
>>> l, m = cube.levels, cube.measures
>>> m["Bottom 5"] = tt.array.n_lowest(m["PnL.SUM"], n=5)
>>> cube.query(m["PnL.SUM"], m["Bottom 5"])
                          PnL.SUM                       Bottom 5
0  doubleVector[10]{-20.163, ...}  doubleVector[5]{-20.163, ...}
Parameters:
  • measure (VariableMeasureConvertible)

  • n (PositiveInt | VariableMeasureConvertible)

Return type:

MeasureDescription