CurrentModule = Temporal
One can perform a full outer join on the time index
es of two TS
objects
merge(x, y)
ojoin(x, y)
[x y]
hcat(x, y)
Where there are dates in the index
of one that do not exist in the other, values will be filled with NaN
objects. As the missing
functionality matures in Julia's base syntax, it will eventually replace NaN
in this context, since unfortunately NaN
is only applicable for Float64
element types.
merge
ojoin
using Temporal, Dates # hide
x = TS(rand(252))
y = TS(rand(252), x.index .- Month(6))
[x y]
You can do inner joins on TS
objects using the ijoin
function, which will remove any observations corresponding to time steps where at least one of the joined objects is missing a row. This will basically keep only the rows where the time index
of the left side and the right side intersect.
ijoin
using Temporal, Dates # hide
x = TS(rand(252))
y = TS(rand(252), x.index .- Month(6))
ijoin(x, y)
Left and right joins are performed similarly to inner joins and the typical SQL join queries using the index
field each object as the joining key.
- Left Join: keep all observations of the left side of the join, fill the right side with NaN's where missing the corresponding time
index
- Right Join: keep all observations of the right side of the join, fill the left side with NaN's where missing the corresponding time
index
ljoin
rjoin
using Temporal, Dates # hide
x = TS(rand(252))
y = TS(rand(252), x.index .- Month(6))
ljoin(x, y)
rjoin(x, y)