Skip to main content

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​

NameDescriptionAccepted ValuesDefaultRequired
I/O
inputName of input column.string, integer, array—Yes
outputName of new column.string, array—Yes
Options
binsDefines the number of equal-width bins in the range.integer, array—Yes
labelsLabels for the returned bins.string, array, nullnullNo
Conditions
ifCondition that determines whether the wrangle runs as a whole. Recipe variables may be referenced with ${variable}.string—No
whereFilter rows before applying the wrangle using SQL-like criteria, such as column1 = 123 OR column2 = 'abc'.string—No
where_paramsValues 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
GradeStudent
64Charles
92Sabrina
76Edward
84Wendy
Letter Grade
D
A
C
B
Access
RequirementValue
AI-poweredNo
Requires WrangleWorks accountNo
Requires subscriptionNo
Requires external API keyNo
Technical details
FieldValue
Catalog ID12
Catalog keycreate.bins
Recipe keycreate.bins
Catalog statusactive
Lifecycle statusactive
Recipe Writer eligibleYes
Namespacecreate
Documentation groupcreate
AliasesNone
Runtime symbolwrangles.recipe_wrangles.create.bins
Legacy UUID232e3ba0-4735-4934-88aa-0163181abb3f

Sources