Skip to content

Commit

Permalink
docs(examples): add rest arg examples for intersect
Browse files Browse the repository at this point in the history
  • Loading branch information
IndexSeek authored and cpcloud committed Dec 13, 2024
1 parent ac99ebb commit e663faf
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ibis/expr/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -2126,6 +2126,17 @@ def intersect(table: ir.Table, *rest: ir.Table, distinct: bool = True) -> ir.Tab
│ 2 │
│ 2 │
└───────┘
More than two table expressions can be intersected at once.
>>> t3 = ibis.memtable({"a": [2, 3, 3]})
>>> ibis.intersect(t1, t2, t3)
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 2 │
└───────┘
"""
return table.intersect(*rest, distinct=distinct) if rest else table

Expand Down
11 changes: 11 additions & 0 deletions ibis/expr/types/relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -1757,6 +1757,17 @@ def intersect(self, table: Table, *rest: Table, distinct: bool = True) -> Table:
│ 2 │
│ 2 │
└───────┘
More than two table expressions can be intersected at once.
>>> t3 = ibis.memtable({"a": [2, 3, 3]})
>>> t1.intersect(t2, t3)
┏━━━━━━━┓
┃ a ┃
┡━━━━━━━┩
│ int64 │
├───────┤
│ 2 │
└───────┘
"""
return self._assemble_set_op(ops.Intersection, table, *rest, distinct=distinct)

Expand Down

0 comments on commit e663faf

Please sign in to comment.