MCPcopy
hub / github.com/pathwaycom/pathway / with_columns

Method with_columns

python/pathway/internals/table.py:1865–1894  ·  view source on GitHub ↗

Updates columns of `self`, according to args and kwargs. See `table.select` specification for evaluation of args and kwargs. Example: >>> import pathway as pw >>> t1 = pw.debug.table_from_markdown(''' ... | age | owner | pet ... 1 | 10 | Alice | 1

(self, *args: expr.ColumnReference, **kwargs: Any)

Source from the content-addressed store, hash-verified

1863 @trace_user_frame
1864 @desugar
1865 def with_columns(self, *args: expr.ColumnReference, **kwargs: Any) -> Table:
1866 """Updates columns of `self`, according to args and kwargs.
1867 See `table.select` specification for evaluation of args and kwargs.
1868
1869 Example:
1870
1871 >>> import pathway as pw
1872 >>> t1 = pw.debug.table_from_markdown('''
1873 ... | age | owner | pet
1874 ... 1 | 10 | Alice | 1
1875 ... 2 | 9 | Bob | 1
1876 ... 3 | 8 | Alice | 2
1877 ... ''')
1878 >>> t2 = pw.debug.table_from_markdown('''
1879 ... | owner | pet | size
1880 ... 1 | Tom | 1 | 10
1881 ... 2 | Bob | 1 | 9
1882 ... 3 | Tom | 2 | 8
1883 ... ''')
1884 >>> t3 = t1.with_columns(*t2)
1885 >>> pw.debug.compute_and_print(t3, include_id=False)
1886 age | owner | pet | size
1887 8 | Tom | 2 | 8
1888 9 | Bob | 1 | 9
1889 10 | Tom | 1 | 10
1890 """
1891 other = self.select(*args, **kwargs)
1892 columns = dict(self)
1893 columns.update(other)
1894 return self.select(**columns)
1895
1896 @trace_user_frame
1897 @desugar

Callers 15

update_cellsMethod · 0.95
cast_to_typesMethod · 0.95
flattenMethod · 0.95
combine_metadataFunction · 0.80
_clean_tableMethod · 0.80
build_pipelineMethod · 0.80
_query_chatFunction · 0.80
_apply_rerankingMethod · 0.80
_update_columnsMethod · 0.80
__init__Method · 0.80

Calls 2

selectMethod · 0.95
updateMethod · 0.45

Tested by 15

get_differencesFunction · 0.64
test_skipsFunction · 0.64
test_twoclass_methodFunction · 0.64
test_twoclass_method2Function · 0.64
test_pointer_orderFunction · 0.64
test_tuplesFunction · 0.64
test_nested_tuplesFunction · 0.64
test_tuples_int_floatFunction · 0.64
test_tuples_noneFunction · 0.64
test_tuples_none_cmpFunction · 0.64