From e663faf728a5b50b8db6dc1f9c3745fee472ce85 Mon Sep 17 00:00:00 2001 From: Tyler White <50381805+IndexSeek@users.noreply.github.com> Date: Tue, 3 Dec 2024 02:20:18 +0000 Subject: [PATCH] docs(examples): add rest arg examples for intersect --- ibis/expr/api.py | 11 +++++++++++ ibis/expr/types/relations.py | 11 +++++++++++ 2 files changed, 22 insertions(+) diff --git a/ibis/expr/api.py b/ibis/expr/api.py index 0be1c52a6062..5c726715b447 100644 --- a/ibis/expr/api.py +++ b/ibis/expr/api.py @@ -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 diff --git a/ibis/expr/types/relations.py b/ibis/expr/types/relations.py index 22ab9bbd3d21..ebbdea59c3c2 100644 --- a/ibis/expr/types/relations.py +++ b/ibis/expr/types/relations.py @@ -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)