The Bin node allows you to "bin" relatively continuous numeric values into collective output fields to be used instead.
For example, you could apply the Bin node to a Customer Age field to create a new field where each record represents an age range.
Consider a data set where you had to separate children from adults, using age.
id |
age |
---|---|
001 |
12 |
002 |
17 |
003 |
18 |
004 |
22 |
005 |
21 |
Here you could create one bin from 0 to 18 with an output value of 0 and another bin from 18 to 25 with an output value of 1. This would bin the data in the following manner:
id |
age |
binField |
---|---|---|
001 |
12 |
0 |
002 |
17 |
0 |
003 |
18 |
1 |
004 |
22 |
1 |
005 |
21 |
1 |
Bin To Values are Not Inclusive
Note that although the first bin ranges from 0 to 18, the value 18 is placed in the second bin for adults. This is because the To values in bin ranges are not inclusive.
Missing Value Parameter (optional)
The Bin node also gives you the option to specify a Missing Value parameter. If specified, this is the value that will be used for any incoming value that does not fall within the range of any bin in your configuration.
Continuing the age example above, 26 would be one such value. Were we to specify 2 as the Missing Value parameter, 26 and all other values that did not fall within the ranges of our bins would be assigned a value of 2 in the generated binField field. On the other hand, if we were to leave Missing Value blank, these incoming values would be assigned a value of null in the binField field.