bdf.save#
- bdf.save(df: pl.DataFrame | pl.LazyFrame | pd.DataFrame, pathlike: str | Path, *, metadata: dict | None = None, validate: bool = True, labels: Literal['preferred', 'machine', 'unchanged'] = 'unchanged', **opts) None[source]#
Save a BDF table to a CSV/parquet/IPC/JSON/ndjson/xlsx artifact.
Detects format and compression from the file extension and creates parent directories as needed.
- Parameters:
df – BDF table to write.
pathlike – Output file path; format/compression are inferred from its extension.
metadata – Optional metadata dict written alongside as a
.metadata.jsonsidecar.validate – Check columns against the BDF ontology, raising on missing required ones (default True); False only warns.
labels – Style of column names to use (default: “unchanged”): “preferred”: BDF preferred label, e.g. “Voltage / V” “machine”: BDF machine-readable label e.g. “voltage_volt” “unchanged”: Keep column names as-is
**opts – Additional keyword arguments forwarded to the polars writer (
write_csv/write_parquet/write_ipc/write_json/write_ndjson/write_excel).
- Raises:
ValueError – If the format is unsupported, or compression is requested for xlsx output.