Returns a copy of a table. Example: >>> import pathway as pw >>> t1 = pw.debug.table_from_markdown(''' ... age | owner | pet ... 10 | Alice | dog ... 9 | Bob | dog ... 8 | Alice | cat ... 7 | Bob | dog ... ''')
(self)
| 1152 | @contextualized_operator |
| 1153 | @check_arg_types |
| 1154 | def copy(self) -> Table[TSchema]: |
| 1155 | """Returns a copy of a table. |
| 1156 | |
| 1157 | Example: |
| 1158 | |
| 1159 | >>> import pathway as pw |
| 1160 | >>> t1 = pw.debug.table_from_markdown(''' |
| 1161 | ... age | owner | pet |
| 1162 | ... 10 | Alice | dog |
| 1163 | ... 9 | Bob | dog |
| 1164 | ... 8 | Alice | cat |
| 1165 | ... 7 | Bob | dog |
| 1166 | ... ''') |
| 1167 | >>> t2 = t1.copy() |
| 1168 | >>> pw.debug.compute_and_print(t2, include_id=False) |
| 1169 | age | owner | pet |
| 1170 | 7 | Bob | dog |
| 1171 | 8 | Alice | cat |
| 1172 | 9 | Bob | dog |
| 1173 | 10 | Alice | dog |
| 1174 | >>> t1 is t2 |
| 1175 | False |
| 1176 | """ |
| 1177 | |
| 1178 | return self._copy_as(type(self)) |
| 1179 | |
| 1180 | def _copy_as(self, table_type: type[TTable], /, **kwargs) -> TTable: |
| 1181 | columns = { |