ds_provider_xledger_py_lib.utils.dataframe

File: dataframe.py Region: ds_provider_xledger_py_lib/utils

Description

Small dataframe helpers shared by serializer and deserializer.

Functions

dataframe_to_records(→ list[dict[str, Any]])

Convert dataframe rows to JSON-safe records with None for nulls.

edges_to_dataframe(→ pandas.DataFrame)

Flatten edges[].node payload into a dataframe.

Module Contents

ds_provider_xledger_py_lib.utils.dataframe.dataframe_to_records(df: pandas.DataFrame) list[dict[str, Any]][source]

Convert dataframe rows to JSON-safe records with None for nulls.

Parameters:

df – Input dataframe.

Returns:

List of row dictionaries.

ds_provider_xledger_py_lib.utils.dataframe.edges_to_dataframe(*, edges: list[dict[str, Any]], columns: list[str] | None = None) pandas.DataFrame[source]

Flatten edges[].node payload into a dataframe.

Parameters:
  • edges – GraphQL connection edges.

  • columns – Optional explicit column order/filter.

Returns:

Flattened dataframe.