mecfs_bio.build_system.task.dataframe_output
How a task writes a dataframe asset: the output format types, and the single writer that interprets them.
Classes:
-
CSVOutFormat– -
ParquetEncoding–pyarrow parquet writer encoding arguments, as derived by parquet_encoding.
-
ParquetOutFormat– -
ParquetWriteOptions–How to encode a parquet output, when the defaults are not good enough.
Functions:
-
float_column_names–Names of the floating-point columns, the ones worth byte-stream-splitting.
-
get_extension_and_read_spec_from_format– -
open_parquet_writer–A streaming parquet writer with the given encoding; close it (or use with).
-
parquet_encoding–Writer encoding with BYTE_STREAM_SPLIT on the named columns and dictionary elsewhere.
-
write_df_according_to_format–Write a dataframe to out_path in the requested format.
-
write_parquet_table–Write an arrow table to parquet with explicit encoding control (see parquet_encoding).
Attributes:
ParquetCompression
module-attribute
ParquetEncoding
pyarrow parquet writer encoding arguments, as derived by parquet_encoding.
Attributes:
-
compression(ParquetCompression) – -
compression_level(int | None) – -
use_byte_stream_split(list[str] | bool) – -
use_dictionary(list[str] | bool) –
ParquetOutFormat
Attributes:
-
write_options(ParquetWriteOptions | None) –
ParquetWriteOptions
How to encode a parquet output, when the defaults are not good enough.
Attributes:
-
byte_stream_split_floats(bool) – -
compression(ParquetCompression) – -
compression_level(int | None) –
float_column_names
Names of the floating-point columns, the ones worth byte-stream-splitting.
Source code in mecfs_bio/build_system/task/dataframe_output.py
get_extension_and_read_spec_from_format
Source code in mecfs_bio/build_system/task/dataframe_output.py
open_parquet_writer
open_parquet_writer(
out_path: Path,
schema: Schema,
encoding: ParquetEncoding,
) -> pyarrow.parquet.ParquetWriter
A streaming parquet writer with the given encoding; close it (or use with).
Source code in mecfs_bio/build_system/task/dataframe_output.py
parquet_encoding
parquet_encoding(
column_names: Sequence[str],
compression: ParquetCompression,
compression_level: int | None,
byte_stream_split_columns: Sequence[str],
) -> ParquetEncoding
Writer encoding with BYTE_STREAM_SPLIT on the named columns and dictionary elsewhere.
Dictionary encoding takes precedence over BYTE_STREAM_SPLIT in the parquet writer: a column left dictionary-enabled is written as RLE_DICTIONARY and the requested split is silently dropped. Dictionary encoding is therefore disabled on exactly the split columns and left on for the rest, where it is what makes low-cardinality columns small. The split applies to any fixed-width column (pyarrow 25 supports integer as well as floating-point types).
Pass an empty byte_stream_split_columns to disable the split entirely.
Source code in mecfs_bio/build_system/task/dataframe_output.py
write_df_according_to_format
Write a dataframe to out_path in the requested format. The frame's backend is preserved: narwhals dispatches to the underlying library's own writer
Source code in mecfs_bio/build_system/task/dataframe_output.py
write_parquet_table
write_parquet_table(
table: Table,
out_path: Path,
compression: ParquetCompression,
compression_level: int | None,
byte_stream_split_columns: Sequence[str],
) -> None
Write an arrow table to parquet with explicit encoding control (see parquet_encoding).