argsort#

bamengine.ops.argsort(a)[source]#

Return indices that would sort the array.

Parameters:

a (array) – Array to sort.

Returns:

Indices that sort the array.

Return type:

int array

Examples

>>> import bamengine.ops as ops
>>> prices = np.array([30, 10, 20])
>>> sorted_indices = ops.argsort(prices)
>>> # sorted_indices: [1, 2, 0]
>>> # prices[sorted_indices] would be [10, 20, 30]