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

Method with_suffix

python/pathway/internals/table.py:2124–2143  ·  view source on GitHub ↗

Rename columns by adding suffix 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, suffix: str)

Source from the content-addressed store, hash-verified

2122
2123 @check_arg_types
2124 def with_suffix(self, suffix: str) -> Table:
2125 """Rename columns by adding suffix to each name of column.
2126
2127 Example:
2128
2129 >>> import pathway as pw
2130 >>> t1 = pw.debug.table_from_markdown('''
2131 ... age | owner | pet
2132 ... 10 | Alice | 1
2133 ... 9 | Bob | 1
2134 ... 8 | Alice | 2
2135 ... ''')
2136 >>> t2 = t1.with_suffix("_current")
2137 >>> pw.debug.compute_and_print(t2, include_id=False)
2138 age_current | owner_current | pet_current
2139 8 | Alice | 2
2140 9 | Bob | 1
2141 10 | Alice | 1
2142 """
2143 return self.rename_by_dict({name: name + suffix for name in self.keys()})
2144
2145 @trace_user_frame
2146 @check_arg_types

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