digitize#

swordfish.function.digitize()#

Return the indices of the bins to which each value in x belongs. The return value has the same data form as x.

right

order of bins

returned index i satisfies

false

increasing

bins[i-1] <= x < bins[i]

true

increasing

bins[i-1] < x <= bins[i]

false

decreasing

bins[i-1] > x >= bins[i]

true

decreasing

bins[i-1] >= x > bins[i]

If values in x are beyond the bounds of bins, 0 (for values beyond left bound) or length of bins (for values beyond right bound) is returned.

Parameters:
  • x (Constant) – A scalar or vector of floating-point, integral, or DECIMAL type, indicating the value to be binned.

  • bins (Constant) – A monotonically increasing or decreasing vector of floating-point, integral, or DECIMAL type, indicating the bins.

  • right (Constant, optional) – A Boolean value indicating whether the intervals include the right or the left bin edge. Default behavior is right=false indicating that the interval includes the left edge.