public digitize(notnull edges as NDArray<Double>, right as Boolean = false) as NDArray<Long>
Assigns every element to a monotone sequence of bin boundaries. Ascending: edges[i-1] <= x < edges[i], reversed when right=true. Descending edges are supported. Output 0/edges.size denotes outside bins; NaN maps after all ascending edges (before all descending edges). Time O(N log B), O(N+B) storage, no source mutation.
| Parameter | Description |
|---|---|
edges | Non-empty finite strictly monotone 1D Double boundaries. |
right | Include the right endpoint rather than the left. |
Long insertion indices with the same shape as the source.
indices = data.digitize(NDArray<Double>([0.0, 1.0, 2.0]))