qis.utils.quantile_buckets.assign_bucket_codes

qis.utils.quantile_buckets.assign_bucket_codes(x, edges)[source]

Bucket of each observation for given interior edges, closed on the right with open ends.

Parameters:
  • x (ndarray | Series) – observations

  • edges (Sequence[float] | ndarray) – interior edges, non-decreasing; estimated from x or supplied, e.g. from another sample or fixed thresholds

Returns:

integer bucket per observation, 0 for the lowest, the number of edges strictly below the observation; -1 for a NaN or infinite observation

Return type:

ndarray