atoti.array.n_greatest_indices module#
- atoti.array.n_greatest_indices(measure, /, n)#
Return an array measure containing the indices of the n greatest elements of the passed array measure.
The indices in the returned array are sorted, so the first index corresponds to the greatest value and the last index to to the n-th greatest value.
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["Top 3 indices"] = tt.array.n_greatest_indices(m["PnL.SUM"], n=3) >>> cube.query(m["PnL.SUM"], m["Top 3 indices"]) PnL.SUM Top 3 indices 0 doubleVector[10]{-20.163, ...} intVector[3]{6, ...}
- Return type