Find which bin each value falls into.
Numeric.stat.digitize(values, edges, closed = false)Reports the bin index of every value.
- Parameters:
values: Values placed into the binsedges: Bin edges used for the groupingclosed: When true returns the bin on the right of the edge
- Returns: Bin index for each value
- NumPy: Equivalent to
np.digitize.
import Numeric from '@neabyte/numerix'
const bins = Numeric.stat.digitize([1, 5, 9], [2, 6])
console.log(bins)
// [0,1,2]import Numeric from '@neabyte/numerix'
const bins = Numeric.stat.digitize([1, 5, 9], [2, 6], true)
console.log(bins)
// [0,1,2]import Numeric from '@neabyte/numerix'
const bins = Numeric.stat.digitize([1, 3, 5, 7], [2, 4, 6])
console.log(bins)
// [0,1,2,3]import Numeric from '@neabyte/numerix'
const bins = Numeric.stat.digitize([0, 1], [5, 10])
console.log(bins)
// [0,0]