Conditional left join 2 dataframes when none of the columns are common

FlexiJoins.jl supports many table types, but not all. Specifically, I think it doesn’t work with DataFrames.jl.
Joining by the condition you need is pretty easy and efficient with FlexiJoins:

julia> using Tables, FlexiJoins, IntervalSets

julia> tbl1 = (id = [1,101,1001], b = [1,2,3]) |> rowtable
julia> tbl2 = (id1 = [0, 95 ], id2 = [50, 150 ], c = [2,3]) |> rowtable

julia> leftjoin((tbl1, tbl2), by_pred(:id, ∈, r -> r.id1..r.id2))

Here, I use rowtable (vector-of-namedtuples) as the input table type for simplicity.

1 Like