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

Function table_to_pandas

python/pathway/debug/__init__.py:285–298  ·  view source on GitHub ↗
(table: Table, *, include_id: bool = True)

Source from the content-addressed store, hash-verified

283@check_arg_types
284@trace_user_frame
285def table_to_pandas(table: Table, *, include_id: bool = True):
286 keys, columns = table_to_dicts(table)
287 series_dict = {}
288 for name in columns:
289 dtype = _dtype_to_pandas(table.schema.typehints()[name])
290 if include_id:
291 series = pd.Series(columns[name], dtype=dtype)
292 else:
293 # we need to remove original keys, otherwise pandas will use them to create index
294 series = pd.Series(list(columns[name].values()), dtype=dtype)
295 series_dict[name] = series
296 index = keys if include_id else None
297 res = pd.DataFrame(series_dict, index=index)
298 return res
299
300
301def _validate_dataframe(df: pd.DataFrame, stacklevel: int = 1) -> None:

Callers 15

test_bucketer_euclideanFunction · 0.90
test_bucketer_cosineFunction · 0.90
test_lshFunction · 0.90
test_clustering_via_lshFunction · 0.90
test_float_powFunction · 0.90
test_mixed_int_float_powFunction · 0.90
run_matrix_multiplcationFunction · 0.90
test_aknnFunction · 0.90
test_skip_list_bigFunction · 0.90

Calls 4

table_to_dictsFunction · 0.85
_dtype_to_pandasFunction · 0.85
valuesMethod · 0.80
typehintsMethod · 0.45

Tested by 14

test_bucketer_euclideanFunction · 0.72
test_bucketer_cosineFunction · 0.72
test_lshFunction · 0.72
test_clustering_via_lshFunction · 0.72
test_float_powFunction · 0.72
test_mixed_int_float_powFunction · 0.72
run_matrix_multiplcationFunction · 0.72
test_aknnFunction · 0.72
test_skip_list_bigFunction · 0.72