datatable.intersect()¶
Find the intersection of sets of values in the 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
perform the
intersection operation
on these sets, returning those values that are present in each
of the provided frames
.
Parameters¶
*frames
Frame
| Frame
| ...
Input single-column frames.
return
Frame
A single-column frame. The column stype is the smallest common
stype of columns in the frames
.
except
ValueError
| NotImplementedError
raised when one of the input frames has more than one column. |
|
raised when one of the columns has stype |
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 |
Intersection of the two frames:
dt.intersect([s1, s2])
C0 | ||
---|---|---|
int32 | ||
0 | 5 | |
1 | 42 |
The content on this page is licensed under the Creative Commons Attribution 4.0 License
(CC BY 4.0) ,
and code samples are licensed under the MIT License.