transformations:intervalmerge
This is an old revision of the document!
Interval merge
This action merges two tables based on whether a value in one table falls into a range specified by two values in another table.
The lower boundary of a range is inclusive, the upper is exclusive. Ranges can overlap, in this case one row for each match will be inserted into the resulting table.
Example
Table 1: Boundaries
Lower | Upper | Feels |
---|---|---|
0 | 15 | Cold |
15 | 25 | Comfortable |
25 | 99 | Hot |
Table 2: Temperature in Toronto (Celsius)
Month | High, C |
---|---|
Jan | 0 |
Feb | 0 |
Mar | 4 |
Apr | 12 |
May | 19 |
Jun | 24 |
Jul | 27 |
Aug | 26 |
Sep | 23 |
Oct | 15 |
Nov | 9 |
Dec | 3 |
Goal: find what it feels like in Toronto during a year.
Solution: merge using the "Interval merge" action where [Temperature in Toronto] is between [Lower] and [Upper].
Table: Result
Month | High, C | Feels |
---|---|---|
Jan | 0 | Cold |
Feb | 0 | Cold |
Mar | 4 | Cold |
Apr | 12 | Cold |
May | 19 | Comfortable |
Jun | 24 | Comfortable |
Jul | 27 | Hot |
Aug | 26 | Hot |
Sep | 23 | Comfortable |
Oct | 15 | Comfortable |
Nov | 9 | Cold |
Dec | 3 | Cold |
See also
transformations/intervalmerge.1606941114.txt.gz · Last modified: 2020/12/02 15:31 by dmitry