r"""Restrict self universe to keys not appearing in the other table. Args: other: table with ids to remove from self. Returns: Table: table with restricted universe, with the same set of columns Example: >>> import pathway as pw >>
(self, other: Table)
| 986 | @contextualized_operator |
| 987 | @check_arg_types |
| 988 | def difference(self, other: Table) -> Table[TSchema]: |
| 989 | r"""Restrict self universe to keys not appearing in the other table. |
| 990 | |
| 991 | Args: |
| 992 | other: table with ids to remove from self. |
| 993 | |
| 994 | Returns: |
| 995 | Table: table with restricted universe, with the same set of columns |
| 996 | |
| 997 | |
| 998 | Example: |
| 999 | |
| 1000 | >>> import pathway as pw |
| 1001 | >>> t1 = pw.debug.table_from_markdown(''' |
| 1002 | ... | age | owner | pet |
| 1003 | ... 1 | 10 | Alice | 1 |
| 1004 | ... 2 | 9 | Bob | 1 |
| 1005 | ... 3 | 8 | Alice | 2 |
| 1006 | ... ''') |
| 1007 | >>> t2 = pw.debug.table_from_markdown(''' |
| 1008 | ... | cost |
| 1009 | ... 2 | 100 |
| 1010 | ... 3 | 200 |
| 1011 | ... 4 | 300 |
| 1012 | ... ''') |
| 1013 | >>> t3 = t1.difference(t2) |
| 1014 | >>> pw.debug.compute_and_print(t3, include_id=False) |
| 1015 | age | owner | pet |
| 1016 | 10 | Alice | 1 |
| 1017 | """ |
| 1018 | context = clmn.DifferenceContext( |
| 1019 | left=self._id_column, |
| 1020 | right=other._id_column, |
| 1021 | ) |
| 1022 | return self._table_with_context(context) |
| 1023 | |
| 1024 | @check_arg_types |
| 1025 | def intersect(self, *tables: Table) -> Table[TSchema]: |