snowflake.snowpark.functions.width_bucket¶
- snowflake.snowpark.functions.width_bucket(expr: Union[snowflake.snowpark.column.Column, str], min_value: Union[snowflake.snowpark.column.Column, str], max_value: Union[snowflake.snowpark.column.Column, str], num_buckets: Union[snowflake.snowpark.column.Column, str]) Column[source]¶
Constructs equi-width histograms, in which the histogram range is divided into intervals that have identical sizes, returning the bucket number that the input expression would be assigned to.
- Parameters:
expr (ColumnOrName) – The expression to evaluate and assign to a bucket.
min_value (ColumnOrName) – The minimum value of the histogram range.
max_value (ColumnOrName) – The maximum value of the histogram range.
num_buckets (ColumnOrName) – The number of buckets to create.
- Returns:
The bucket number (1-based) that the input expression falls into.
- Return type:
- Examples::