pyarrow.compress

pyarrow.compress(buf, codec='lz4', asbytes=False, memory_pool=None)

Compress data from buffer-like object.

Parameters
  • buf (pyarrow.Buffer, bytes, or other object supporting buffer protocol) –

  • codec (str, default 'lz4') – Compression codec. Supported types: {‘brotli, ‘gzip’, ‘lz4’, ‘lz4_raw’, ‘snappy’, ‘zstd’}

  • asbytes (bool, default False) – Return result as Python bytes object, otherwise Buffer.

  • memory_pool (MemoryPool, default None) – Memory pool to use for buffer allocations, if any.

Returns

compressed (pyarrow.Buffer or bytes (if asbytes=True))