Bins
Create a column that groups data into bins.
Creates a column that segments and sorts data values into bins. bins can be an integer or a list. When bins is an integer, the input data is split equally into that number of bins. When bins is a list, the input data is split based on the list boundaries.
Parameters
| Name | Description | Accepted Values | Default | Required |
|---|---|---|---|---|
| I/O | ||||
input | Name of input column. | string, integer, array | — | Yes |
output | Name of new column. | string, array | — | Yes |
| Options | ||||
bins | Defines the number of equal-width bins in the range. | integer, array | — | Yes |
labels | Labels for the returned bins. | string, array, null | null | No |
| Conditions | ||||
if | Condition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}. | string | — | No |
where | Filter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'. | string | — | No |
where_params | Values used with where for parameterized criteria. Uses SQLite placeholder syntax such as ? or :name. | array, object | — | No |
Examples
wrangles:
- create.bins:
input: Data
output: Category
bins: 3
labels:
- Bad
- Medium
- Good
| Data |
|---|
| 1 |
| 7 |
| 5 |
| 4 |
| 6 |
| 3 |
| Category |
|---|
| Bad |
| Good |
| Medium |
| Medium |
| Good |
| Bad |
wrangles:
- create.bins:
input: Grades
output: Letter Grade
bins:
- 0
- 60
- 70
- 80
- 90
- 100
labels:
- F
- D
- C
- B
- A
| Grade | Student |
|---|---|
| 64 | Charles |
| 92 | Sabrina |
| 76 | Edward |
| 84 | Wendy |
| Letter Grade |
|---|
| D |
| A |
| C |
| B |
Access
| Requirement | Value |
|---|---|
| AI-powered | No |
| Requires WrangleWorks account | No |
| Requires subscription | No |
| Requires external API key | No |
Technical details
| Field | Value |
|---|---|
| Catalog ID | 12 |
| Catalog key | create.bins |
| Recipe key | create.bins |
| Catalog status | active |
| Lifecycle status | active |
| Recipe Writer eligible | Yes |
| Namespace | create |
| Documentation group | create |
| Aliases | None |
| Runtime symbol | wrangles.recipe_wrangles.create.bins |
| Legacy UUID | 232e3ba0-4735-4934-88aa-0163181abb3f |
Sources