chickadee » dataframe » df-full-join

(df-full-join left-df right-df by [suffix: '(".x" . ".y")])procedure

Keeps every row of both data frames, filling the other side with na where there's no match.

by is one of:

a symbol
join on that column, same name on both sides
a list of symbols
join on all of them, same names on both sides
a list of (left-key . right-key) pairs
for differently-named join columns, e.g. '((dept-id . id))

The output's join-key column is always named after the left side's key and takes the left row's value when there is one, falling back to the right row's value (under its own name) for a right-only row in a right/full join. Duplicate keys fan out into the cross product of matches, as in a real relational join. Non-key columns that collide between the two sides are renamed with suffix (a (left . right) pair of strings, default (".x" . ".y")).

(df-inner-join users orders 'user-id)
(df-left-join employees departments '((dept-id . id)))
(df-inner-join sales targets '(date store-id) suffix: (cons ".a" ".b"))