pyarrow.binary

pyarrow.binary(int length=-1)

Create variable-length or fixed size binary type.

Parameters:
lengthint, optional, default -1

If length == -1 then return a variable length binary type. If length is greater than or equal to 0 then return a fixed size binary type of width length.

Examples

Create an instance of a variable-length binary type:

>>> import pyarrow as pa
>>> pa.binary()
DataType(binary)

and use the variable-length binary type to create an array:

>>> pa.array(['foo', 'bar', 'baz'], type=pa.binary())
<pyarrow.lib.BinaryArray object at ...>
[
  666F6F,
  626172,
  62617A
]

Create an instance of a fixed-size binary type:

>>> pa.binary(3)
FixedSizeBinaryType(fixed_size_binary[3])

and use the fixed-length binary type to create an array: >>> pa.array([‘foo’, ‘bar’, ‘baz’], type=pa.binary(3)) <pyarrow.lib.FixedSizeBinaryArray object at …> [

666F6F, 626172, 62617A

]