MCPcopy Index your code
hub / github.com/pathwaycom/pathway / with_prefix

Method with_prefix

python/pathway/internals/table.py:2102–2121  ·  view source on GitHub ↗

Rename columns by adding prefix to each name of column. Example: >>> import pathway as pw >>> t1 = pw.debug.table_from_markdown(''' ... age | owner | pet ... 10 | Alice | 1 ... 9 | Bob | 1 ... 8 | Alice | 2 ... ''') >>>

(self, prefix: str)

Source from the content-addressed store, hash-verified

2100
2101 @check_arg_types
2102 def with_prefix(self, prefix: str) -> Table:
2103 """Rename columns by adding prefix to each name of column.
2104
2105 Example:
2106
2107 >>> import pathway as pw
2108 >>> t1 = pw.debug.table_from_markdown('''
2109 ... age | owner | pet
2110 ... 10 | Alice | 1
2111 ... 9 | Bob | 1
2112 ... 8 | Alice | 2
2113 ... ''')
2114 >>> t2 = t1.with_prefix("u_")
2115 >>> pw.debug.compute_and_print(t2, include_id=False)
2116 u_age | u_owner | u_pet
2117 8 | Alice | 2
2118 9 | Bob | 1
2119 10 | Alice | 1
2120 """
2121 return self.rename_by_dict({name: prefix + name for name in self.keys()})
2122
2123 @check_arg_types
2124 def with_suffix(self, suffix: str) -> Table:

Callers 2

test_slices_1Function · 0.45
test_slices_2Function · 0.45

Calls 2

rename_by_dictMethod · 0.95
keysMethod · 0.95

Tested by 2

test_slices_1Function · 0.36
test_slices_2Function · 0.36