datatable.setdiff()¶
Find the set difference between frame0 and the other frames.
Each frame should have only a single column or be empty.
The values in each frame will be treated as a set, and this function will
compute the
set difference
between the frame0 and the union of the other
frames, returning those values that are present in the frame0,
but not present in any of the frames.
Parameters¶
FrameInput single-column frame.
Frame | Frame | ...Input single-column frames.
FrameA single-column frame. The column stype is the smallest common
stype of columns from the frames.
Examples¶
from datatable import dt
s1 = dt.Frame([4, 5, 6, 20, 42])
s2 = dt.Frame([1, 2, 3, 5, 42])
s1
| C0 | ||
|---|---|---|
| int32 | ||
| 0 | 4 | |
| 1 | 5 | |
| 2 | 6 | |
| 3 | 20 | |
| 4 | 42 |
s2
| C0 | ||
|---|---|---|
| int32 | ||
| 0 | 1 | |
| 1 | 2 | |
| 2 | 3 | |
| 3 | 5 | |
| 4 | 42 |
Set difference of the two frames:
dt.setdiff(s1, s2)
| C0 | ||
|---|---|---|
| int32 | ||
| 0 | 4 | |
| 1 | 6 | |
| 2 | 20 |
See Also¶
intersect()– calculate the set intersection of values in the frames.symdiff()– calculate the symmetric difference between the sets of values in the frames.union()– calculate the union of values in the frames.unique()– find unique values in a frame.