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

Function static_table_from_pandas

python/pathway/tests/test_api.py:42–70  ·  view source on GitHub ↗
(scope, df, ptr_columns=(), legacy=True)

Source from the content-addressed store, hash-verified

40
41
42def static_table_from_pandas(scope, df, ptr_columns=(), legacy=True):
43 for column in ptr_columns:
44 df[column] = df[column].apply(api.unsafe_make_pointer)
45
46 schema = schema_from_pandas(df)
47
48 columns: list[api.ColumnProperties] = []
49
50 for col in schema.columns().values():
51 columns.append(
52 api.ColumnProperties(
53 dtype=col.dtype.to_engine(),
54 append_only=col.append_only,
55 )
56 )
57
58 connector_properties = api.ConnectorProperties(
59 unsafe_trusted_ids=True,
60 column_properties=columns,
61 )
62
63 table = api.static_table_from_pandas(
64 scope,
65 df,
66 connector_properties,
67 )
68 if legacy:
69 table = table_to_legacy(scope, table, len(df.columns))
70 return table
71
72
73def convert_table(scope, table):

Callers 1

static_table_from_mdFunction · 0.70

Calls 6

schema_from_pandasFunction · 0.85
table_to_legacyFunction · 0.85
applyMethod · 0.80
valuesMethod · 0.80
columnsMethod · 0.45
to_engineMethod · 0.45

Tested by

no test coverage detected