dataset_exports

graphcalc.additive_combinatorics.dataset_exports.additive_package_to_dataframe(package: dict) DataFrame[source]

Convert a dataset package dictionary to a pandas DataFrame.

Parameters:

package (dict) – Dataset package containing a "rows" entry.

Returns:

DataFrame built from package["rows"].

Return type:

pandas.DataFrame

Raises:
  • KeyError – If the package does not contain a "rows" entry.

  • TypeError – If package["rows"] is not iterable in the expected way.

graphcalc.additive_combinatorics.dataset_exports.additive_rows_to_dataframe(rows: Iterable[dict]) DataFrame[source]

Convert additive-combinatorics dataset rows to a pandas DataFrame.

Parameters:

rows (iterable of dict) – Dataset rows, typically produced by graphcalc.additive_combinatorics.dataset_generators.generate_additive_set_dataset() or one of the snapshot helpers.

Returns:

DataFrame whose columns are determined by the row keys.

Return type:

pandas.DataFrame

Notes

This function does not require any specific schema beyond standard dictionary-like dataset rows, but it is intended primarily for use with the additive-combinatorics conjecturing records defined by this package.

graphcalc.additive_combinatorics.dataset_exports.save_additive_column_definitions_json(path: str | Path, *, indent: int = 2) Path[source]

Save the additive dataset column definitions as JSON.

Parameters:
  • path (str or pathlib.Path) – Output JSON path.

  • indent (int, default=2) – Indentation level passed to json.dump().

Returns:

The resolved output path that was written.

Return type:

pathlib.Path

graphcalc.additive_combinatorics.dataset_exports.save_additive_metadata_json(metadata: dict, path: str | Path, *, indent: int = 2) Path[source]

Save dataset metadata as JSON.

Parameters:
  • metadata (dict) – Metadata dictionary to serialize.

  • path (str or pathlib.Path) – Output JSON path.

  • indent (int, default=2) – Indentation level passed to json.dump().

Returns:

The resolved output path that was written.

Return type:

pathlib.Path

graphcalc.additive_combinatorics.dataset_exports.save_additive_package_csv(package: dict, path: str | Path, *, index: bool = False) Path[source]

Save a dataset package as a CSV file.

Parameters:
  • package (dict) – Dataset package containing a "rows" entry.

  • path (str or pathlib.Path) – Output CSV path.

  • index (bool, default=False) – Whether to write the pandas index column.

Returns:

The resolved output path that was written.

Return type:

pathlib.Path