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

Method update_types

python/pathway/internals/table.py:2232–2251  ·  view source on GitHub ↗

Updates types in schema. Has no effect on the runtime.

(self, **kwargs: Any)

Source from the content-addressed store, hash-verified

2230 @trace_user_frame
2231 @check_arg_types
2232 def update_types(self, **kwargs: Any) -> Table:
2233 """Updates types in schema. Has no effect on the runtime."""
2234
2235 for name in kwargs.keys():
2236 if name not in self.keys():
2237 raise ValueError(
2238 "Table.update_types() argument name has to be an existing table column name."
2239 )
2240 new_schema = self.schema.with_types(**kwargs)
2241 for name in kwargs.keys():
2242 left = new_schema._dtypes()[name]
2243 right = self.schema._dtypes()[name]
2244 if not (
2245 dt.dtype_issubclass(left, right) or dt.dtype_issubclass(right, left)
2246 ):
2247 raise TypeError(
2248 f"Cannot change type from {right} to {left}.\n"
2249 + "Table.update_types() should be used only for type narrowing or type extending."
2250 )
2251 return self._with_schema(new_schema)
2252
2253 @trace_user_frame
2254 @check_arg_types

Callers 15

ixMethod · 0.95
filterMethod · 0.80
_pandas_transformerFunction · 0.80
successfulMethod · 0.80
unpack_colFunction · 0.80
unpack_col_dictFunction · 0.80
multiapply_all_rowsFunction · 0.80
_compute_group_reprMethod · 0.80
_mergeMethod · 0.80
_louvain_levelFunction · 0.80
get_nearest_itemsMethod · 0.80

Calls 4

keysMethod · 0.95
_with_schemaMethod · 0.95
with_typesMethod · 0.80
_dtypesMethod · 0.80

Tested by 15

test_left_join_01Function · 0.64
test_right_join_01Function · 0.64
test_left_join_thisFunction · 0.64
test_outer_join_01Function · 0.64
test_outer_join_02Function · 0.64
test_outer_join_03Function · 0.64
test_failedFunction · 0.64
test_sqlite_all_typesFunction · 0.64