The set operations (
union, intersect, setdiff, symdiff, unique) require each input frame to have exactly one column. Passing a multi-column frame raises ValueError. Columns of type obj64 are not supported.union
frames. Returns every distinct value that appears in at least one frame.
Equivalent to dt.unique(dt.rbind(*frames)).
Input single-column frames. Empty frames are accepted.
Returns
A single-column frame of unique values. The column type is the smallest common stype of all input columns. Result is sorted.
Example
intersect
frames. Returns values that are present in every frame.
Input single-column frames. Empty frames are accepted.
Returns
A single-column frame of values common to all inputs. The column type is the smallest common stype of all input columns.
Example
setdiff
frame0 and the other frames. Returns values that are present in frame0 but not in any of the other frames.
The base single-column frame.
One or more single-column frames to subtract from
frame0.Returns
A single-column frame containing values from
frame0 that do not appear in any other input frame. The column type is the smallest common stype of all input columns.Example
symdiff
frames. For two frames this is values that appear in either frame but not both. For more than two frames, values that appear in an odd number of frames are returned.
Input single-column frames. Empty frames are accepted.
Returns
A single-column frame. The column type is the smallest common stype of all input columns.
Example
unique
frame. Values are sorted (using sort-based deduplication; order may change in a future release).
Input frame. May have any number of columns; all values across all columns are pooled together.
Returns
A single-column frame of distinct values. The column type is the smallest common stype for all columns in the input frame. Raises
NotImplementedError for obj64 columns.Example
rbind
Frames to stack vertically.
When
True, frames with mismatching columns (different counts or names) are accepted. Missing cells are filled with NA. Columns with unrelated types are converted to strings.Match columns by name when
True. When False, columns are matched by position instead.Returns
A new frame whose rows are the rows of all input frames concatenated in order.
Example
cbind
Frames to concatenate column-wise.
None values are silently skipped.When
True, frames with unequal row counts are accepted. The result has as many rows as the largest input frame. Shorter frames are padded with NA (frames with exactly 1 row are replicated instead).Returns
A new frame whose columns are the columns of all input frames placed side by side.
Example
Set operations quick reference
| Function | Description | Input |
|---|---|---|
union(*frames) | All distinct values from any frame | 1-column frames |
intersect(*frames) | Values present in every frame | 1-column frames |
setdiff(frame0, *frames) | Values in frame0 not in any other | 1-column frames |
symdiff(*frames) | Values in an odd number of frames | 1-column frames |
unique(frame) | Distinct values across all columns | Any frame |
rbind(*frames) | Stack frames vertically | Any frames |
cbind(*frames) | Stack frames horizontally | Any frames |