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.
Example
Table 1: Boundaries
| Lower | Upper | Feels |
|---|---|---|
| 0 | 15 | Cold |
| 15 | 25 | Comfortable |
| 25 | 99 | Hot |
Table 2: Temperature in Toronto
| 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 |
transformations/intervalmerge.1534340705.txt.gz · Last modified: by dmitry